提交 452ea817 编写于 作者: X xinking129

Merge remote-tracking branch 'upstream/master'

...@@ -53,7 +53,9 @@ group("ability_runtime") { ...@@ -53,7 +53,9 @@ group("ability_runtime") {
"freeinstalltest:freeinstalltest", "freeinstalltest:freeinstalltest",
"newwant:newwant", "newwant:newwant",
"non_concurrent:non_concurrent", "non_concurrent:non_concurrent",
"registerjserror:registerjserror",
"stage:stage", "stage:stage",
"stopserviceextension:stopserviceextension",
"want:want", "want:want",
"workercontextcover:workercontextcover", "workercontextcover:workercontextcover",
] ]
......
...@@ -16,10 +16,6 @@ import("//test/xts/tools/build/suite.gni") ...@@ -16,10 +16,6 @@ import("//test/xts/tools/build/suite.gni")
group("serviceability") { group("serviceability") {
testonly = true testonly = true
if (is_standard_system) { if (is_standard_system) {
deps = [ deps = [ "actsserviceabilityclienttest:ActsServiceAbilityClientTest" ]
"actsserviceabilityclienttest:ActsServiceAbilityClientTest",
"actsserviceabilityserverrelyhap:ActsServiceAbilityServerRelyHap",
"actsserviceabilityserversecondrelyhap:ActsServiceAbilityServerSecondRelyHap",
]
} }
} }
...@@ -11,9 +11,7 @@ ...@@ -11,9 +11,7 @@
"kits": [ "kits": [
{ {
"test-file-name": [ "test-file-name": [
"ActsServiceAbilityClientTest.hap", "ActsServiceAbilityClientTest.hap"
"ActsServiceAbilityServerRelyHap.hap",
"ActsServiceAbilityServerSecondRelyHap.hap"
], ],
"type": "AppInstallKit", "type": "AppInstallKit",
"cleanup-apps": true "cleanup-apps": true
......
...@@ -63,6 +63,24 @@ ...@@ -63,6 +63,24 @@
"type": "page", "type": "page",
"visible": true, "visible": true,
"launchType": "standard" "launchType": "standard"
},
{
"srcPath": "ServiceAbility1",
"name": ".ServiceAbility1",
"icon": "$media:icon",
"srcLanguage": "js",
"description": "$string:description_serviceability",
"visible": true,
"type": "service"
},
{
"srcPath": "ServiceAbility2",
"name": ".ServiceAbility2",
"icon": "$media:icon",
"srcLanguage": "js",
"description": "$string:description_serviceability",
"visible": true,
"type": "service"
} }
], ],
"js": [ "js": [
......
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
import rpc from "@ohos.rpc"; import rpc from "@ohos.rpc";
import particleAbility from '@ohos.ability.particleAbility' import particleAbility from '@ohos.ability.particleAbility'
import commonEvent from '@ohos.commonEvent' import commonEvent from '@ohos.commonEvent'
var serversecond_bundleName = "com.amsst.stserviceabilityserversecond"; var serversecond_bundleName = "com.amsst.stserviceabilityclient";
var serversecond_abilityName = "com.amsst.stserviceabilityserversecond.ServiceAbility"; var serversecond_abilityName = "com.amsst.stserviceabilityclient.ServiceAbility2";
var mConnIdJs; var mConnIdJs;
class StubTest extends rpc.RemoteObject { class StubTest extends rpc.RemoteObject {
constructor(des) { constructor(des) {
......
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
import rpc from "@ohos.rpc"; import rpc from "@ohos.rpc";
import particleAbility from '@ohos.ability.particleAbility' import particleAbility from '@ohos.ability.particleAbility'
import commonEvent from '@ohos.commonEvent' import commonEvent from '@ohos.commonEvent'
var server_bundleName = "com.amsst.stserviceabilityserver"; var server_bundleName = "com.amsst.stserviceabilityclient";
var server_abilityName = "com.amsst.stserviceabilityserver.ServiceAbility"; var server_abilityName = "com.amsst.stserviceabilityclient.ServiceAbility1";
var mConnIdJs; var mConnIdJs;
class StubTest extends rpc.RemoteObject { class StubTest extends rpc.RemoteObject {
constructor(des) { constructor(des) {
......
...@@ -19,8 +19,8 @@ import rpc from "@ohos.rpc"; ...@@ -19,8 +19,8 @@ import rpc from "@ohos.rpc";
import { describe, afterEach, it, expect } from '@ohos/hypium' import { describe, afterEach, it, expect } from '@ohos/hypium'
export default function ActsStServiceAbilityTest() { export default function ActsStServiceAbilityTest() {
describe('ActsStServiceAbilityTest', function () { describe('ActsStServiceAbilityTest', function () {
let bundleName = "com.amsst.stserviceabilityserver"; let bundleName = "com.amsst.stserviceabilityclient";
let abilityName = "com.amsst.stserviceabilityserver.ServiceAbility"; let abilityName = "com.amsst.stserviceabilityclient.ServiceAbility1";
let subscriber0100; let subscriber0100;
let CommonEventSubscribeInfo0100 = { let CommonEventSubscribeInfo0100 = {
......
...@@ -23,6 +23,10 @@ ...@@ -23,6 +23,10 @@
{ {
"name": "TestAbility_label", "name": "TestAbility_label",
"value": "label" "value": "label"
},
{
"name": "description_serviceability",
"value": "hap sample empty service"
} }
] ]
} }
\ No newline at end of file
{
"app": {
"bundleName": "com.amsst.stserviceabilityserver",
"vendor": "test",
"version": {
"code": 1000110,
"name": "1.1.1"
},
"apiVersion": {
"compatible": 8,
"target": 9
}
},
"deviceConfig": {},
"module": {
"package": "com.amsst.stserviceabilityserver",
"name": ".MyApplication",
"mainAbility": ".MainAbility",
"srcPath": "",
"deviceType": [
"default",
"tablet"
],
"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"
},
{
"srcPath": "ServiceAbility",
"name": ".ServiceAbility",
"icon": "$media:icon",
"srcLanguage": "ets",
"description": "$string:description_serviceability",
"visible": true,
"type": "service"
}
],
"js": [
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index",
"pages/second"
],
"name": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"defPermissions": [
{
"name": "com.ohos.screenlock.DataAbilityShellProvider.PROVIDER"
}
]
}
}
/*
* 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 Ability from '@ohos.app.ability.UIAbility'
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.log("jws onCreate");
}
onDestroy() {
console.log("jws onDestroy");
}
onWindowStageCreate(windowStage) {
console.log("jws onWindowStageCreate");
}
onWindowStageDestroy() {
console.log("jws onWindowStageDestroy");
}
onForeground() {
console.log("jws onForeground");
}
onBackground() {
console.log("jws onBackground");
}
call(){
}
}
\ No newline at end of file
/*
* 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 Second {
private content: string = "Second Page"
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('back to index')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.onClick(() => {
router.back()
})
}
.width('100%')
.height('100%')
}
}
\ No newline at end of file
{
"string": [
{
"name": "entry_MainAbility",
"value": "ServiceExtAbility"
},
{
"name": "description_mainability",
"value": "eTS_Empty Ability"
},
{
"name": "description_serviceability",
"value": "hap sample empty service"
},
{
"name": "description_dataability",
"value": "hap sample empty provider"
},
{
"name": "description_mainability2",
"value": "eTS_Empty Ability"
},
{
"name": "entry_MainAbility2",
"value": "entry_MainAbility2"
},
{
"name": "description_testdataability",
"value": "hap sample empty provider"
},
{
"name": "permreason_dataability",
"value": "request dataability premission"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "com.amsst.stserviceabilityserversecond",
"vendor": "test",
"version": {
"code": 1000110,
"name": "1.1.1"
},
"apiVersion": {
"compatible": 8,
"target": 9
}
},
"deviceConfig": {},
"module": {
"package": "com.amsst.stserviceabilityserversecond",
"name": ".MyApplication",
"mainAbility": ".MainAbility",
"srcPath": "",
"deviceType": [
"default",
"tablet"
],
"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"
},
{
"srcPath": "ServiceAbility",
"name": ".ServiceAbility",
"icon": "$media:icon",
"srcLanguage": "ets",
"description": "$string:description_serviceability",
"visible": true,
"type": "service"
}
],
"js": [
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index",
"pages/second"
],
"name": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"defPermissions": [
{
"name": "com.ohos.screenlock.DataAbilityShellProvider.PROVIDER"
}
]
}
}
import Ability from '@ohos.app.ability.UIAbility'
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.log("jws onCreate");
}
onDestroy() {
console.log("jws onDestroy");
}
onWindowStageCreate(windowStage) {
console.log("jws onWindowStageCreate");
}
onWindowStageDestroy() {
console.log("jws onWindowStageDestroy");
}
onForeground() {
console.log("jws onForeground");
}
onBackground() {
console.log("jws onBackground");
}
call(){
}
}
\ No newline at end of file
/*
* 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 Second {
private content: string = "Second Page"
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('back to index')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.onClick(() => {
router.back()
})
}
.width('100%')
.height('100%')
}
}
\ No newline at end of file
{
"string": [
{
"name": "entry_MainAbility",
"value": "ServiceExtAbility"
},
{
"name": "description_mainability",
"value": "eTS_Empty Ability"
},
{
"name": "description_serviceability",
"value": "hap sample empty service"
},
{
"name": "description_dataability",
"value": "hap sample empty provider"
},
{
"name": "description_mainability2",
"value": "eTS_Empty Ability"
},
{
"name": "entry_MainAbility2",
"value": "entry_MainAbility2"
},
{
"name": "description_testdataability",
"value": "hap sample empty provider"
},
{
"name": "permreason_dataability",
"value": "request dataability premission"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "com.example.actsregisterjserrorrely",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"distributedNotificationEnabled": true,
"keepAlive" : true,
"singleUser": true,
"minAPIVersion": 10,
"targetAPIVersion": 10,
"car": {
"apiCompatibleVersion": 10,
"singleUser": false
}
}
}
{
"string": [
{
"name": "app_name",
"value": "ActsRegisterJsErrorRely"
}
]
}
# Copyright (c) 2023 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_hap_assist_suite("ActsRegisterJsErrorRely") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
":actsregisterjserrorrely_js_assets",
":actsregisterjserrorrely_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsRegisterJsErrorRely"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("actsregisterjserrorrely_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("actsregisterjserrorrely_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("actsregisterjserrorrely_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":actsregisterjserrorrely_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
/*
* Copyright (c) 2023 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 hilog from '@ohos.hilog';
import Ability from '@ohos.app.ability.UIAbility'
import Window from '@ohos.window'
import commonEvent from '@ohos.commonEvent'
import ErrorManager from "@ohos.app.ability.errorManager"
let message;
let commonEventData={
parameters:{
message:message,
}
}
export default class EntryAbility extends Ability {
onCreate(want, launchParam) {
globalThis.want = want;
globalThis.context = this.context;
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? '');
hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:' + JSON.stringify(launchParam) ?? '');
}
onDestroy() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
}
onWindowStageCreate(windowStage: Window.WindowStage) {
// Main window is created, set main page for this ability
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
windowStage.loadContent('pages/Index', (err, data) => {
if (err.code) {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.ERROR);
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
return;
}
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? '');
});
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
}
onForeground() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
let observer = undefined;
if (globalThis.want.action == "Acts_RegisterJsErrorCallback_0100") {
observer = {
onUnhandledException(strMsg){
commonEventData.parameters.message = strMsg;
console.info("====>Acts_RegisterJsErrorCallback_0100 onUnhandledException Message: " + strMsg);
commonEvent.publish("ACTS_RegisterEvent_First", commonEventData, (err) => {
console.info("====>Acts_RegisterJsErrorCallback_0100 publish err: " + JSON.stringify(err));
setTimeout(()=>{
globalThis.context.terminateSelf().then(()=>{
console.info("====>Acts_RegisterJsErrorCallback_0100 rely terminateSelf end");
}).catch((err)=>{
console.info("====>Acts_RegisterJsErrorCallback_0100 rely terminateSelf err: " +
JSON.stringify(err));
});
}, 100);
})
}
}
ErrorManager.on("error", observer);
setTimeout(() => {
globalThis.contest.terminateSelf();
}, 300);
} else if (globalThis.want.action == "Acts_RegisterJsErrorCallback_0200") {
observer = {
onUnhandledException(strMsg: String){
commonEventData.parameters.message = strMsg;
console.info("====>Acts_RegisterJsErrorCallback_0200 onUnhandledException Message: " + strMsg);
commonEvent.publish("ACTS_RegisterEvent_First", commonEventData, (err) => {
console.info("====>Acts_RegisterJsErrorCallback_0200 onUnhandledException publish err: " +
JSON.stringify(err));
})
},
onException(errObject: Error){
commonEventData.parameters.message = errObject;
console.info("====>Acts_RegisterJsErrorCallback_0200 onException Message: " + JSON.stringify(errObject));
commonEvent.publish("ACTS_RegisterEvent_Second", commonEventData, (err) => {
console.info("====>Acts_RegisterJsErrorCallback_0200 onException publish err: " +
JSON.stringify(err));
setTimeout(()=>{
globalThis.context.terminateSelf().then(()=>{
console.info("====>Acts_RegisterJsErrorCallback_0200 rely terminateSelf end");
}).catch((err)=>{
console.info("====>Acts_RegisterJsErrorCallback_0200 rely terminateSelf err: " +
JSON.stringify(err));
})
}, 100)
})
}
}
ErrorManager.on("error", observer);
setTimeout(() => {
globalThis.contest.terminateSelf();
}, 300);
} else if (globalThis.want.action == "Acts_UnregisterJsErrorCallback_0800") {
observer = {
onUnhandledException(strMsg: String){
commonEventData.parameters.message = strMsg;
console.info("====>Acts_UnregisterJsErrorCallback_0800 onUnhandledException Message: " + strMsg);
commonEvent.publish("ACTS_RegisterEvent_First", commonEventData, (err) => {
console.info("====>Acts_UnregisterJsErrorCallback_0800 onUnhandledException publish err: " +
JSON.stringify(err));
})
},
onException(errObject: Error){
commonEventData.parameters.message = errObject;
console.info("====>Acts_UnregisterJsErrorCallback_0800 onException Message: " + JSON.stringify(errObject));
commonEvent.publish("ACTS_RegisterEvent_Second", commonEventData, (err) => {
console.info("====>Acts_UnregisterJsErrorCallback_0800 onException publish err: " +
JSON.stringify(err));
setTimeout(()=>{
globalThis.context.terminateSelf().then(()=>{
console.info("====>Acts_UnregisterJsErrorCallback_0800 rely terminateSelf end");
}).catch((err)=>{
console.info("====>Acts_UnregisterJsErrorCallback_0800 rely terminateSelf err: " +
JSON.stringify(err));
})
}, 100)
})
}
}
ErrorManager.on("error", observer);
let observerId = ErrorManager.on("error", observer);
ErrorManager.off("error", observerId).then(()=>{
console.info("====>Acts_UnregisterJsErrorCallback_0800 rely off end");
}).catch((err)=>{
console.info("====>Acts_UnregisterJsErrorCallback_0800 rely off err: " +
JSON.stringify(err));
})
setTimeout(() => {
globalThis.contest.terminateSelf();
}, 300);
}
}
onBackground() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
}
}
/* /*
* Copyright (C) 2022 Huawei Device Co., Ltd. * Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import AbilityStage from "@ohos.app.ability.AbilityStage" @Entry
@Component
export default class MyAbilityStage extends AbilityStage { struct Index {
onCreate() { @State message: string = 'Hello World'
console.log("MyAbilityStage onCreate");
} build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
} }
\ No newline at end of file
{
"module": {
"name": "entry",
"type": "entry",
"description": "$string:module_desc",
"mainElement": "EntryAbility",
"deviceTypes": [
"default",
"tablet"
],
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:main_pages",
"abilities": [
{
"name": "EntryAbility",
"srcEntrance": "./ets/entryability/EntryAbility.ts",
"description": "$string:EntryAbility_desc",
"icon": "$media:icon",
"label": "$string:EntryAbility_label",
"startWindowIcon": "$media:icon",
"startWindowBackground": "$color:start_window_background",
"visible": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
]
}
]
}
}
\ No newline at end of file
{
"color": [
{
"name": "start_window_background",
"value": "#FFFFFF"
}
]
}
\ No newline at end of file
{
"string": [
{
"name": "module_desc",
"value": "module description"
},
{
"name": "EntryAbility_desc",
"value": "description"
},
{
"name": "EntryAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
{
"string": [
{
"name": "module_desc",
"value": "module description"
},
{
"name": "EntryAbility_desc",
"value": "description"
},
{
"name": "EntryAbility_label",
"value": "RegisterJsErrorRely"
}
]
}
\ No newline at end of file
{
"string": [
{
"name": "module_desc",
"value": "模块描述"
},
{
"name": "EntryAbility_desc",
"value": "description"
},
{
"name": "EntryAbility_label",
"value": "RegisterJsErrorRely"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "com.example.actsregisterjserrortest",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"distributedNotificationEnabled": true,
"keepAlive" : true,
"singleUser": true,
"minAPIVersion": 10,
"targetAPIVersion": 10,
"car": {
"apiCompatibleVersion": 10,
"singleUser": false
}
}
}
{
"string": [
{
"name": "app_name",
"value": "ActsRegisterJsErrorTest"
}
]
}
# Copyright (c) 2022 Huawei Device Co., Ltd. # Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
...@@ -9,32 +9,35 @@ ...@@ -9,32 +9,35 @@
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("ActsServiceAbilityServerSecondRelyHap") { ohos_js_hap_suite("ActsRegisterJsErrorTest") {
hap_name = "ActsServiceAbilityServerSecondRelyHap" hap_profile = "entry/src/main/module.json"
js_build_mode = "debug" js_build_mode = "debug"
hap_profile = "entry/src/main/config.json"
testonly = true
deps = [ deps = [
":serviceability_resources", ":actsregisterjserrortest_js_assets",
":serviceability_ts_assets", ":actsregisterjserrortest_resources",
] ]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b" certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsRegisterJsErrorTest"
subsystem_name = "ability" subsystem_name = "ability"
part_name = "ability_runtime" part_name = "ability_runtime"
} }
ohos_js_assets("serviceability_ts_assets") { ohos_app_scope("actsregisterjserrortest_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("actsregisterjserrortest_js_assets") {
source_dir = "entry/src/main/ets" source_dir = "entry/src/main/ets"
hap_profile = "entry/src/main/config.json"
ets2abc = true
} }
ohos_resources("serviceability_resources") { ohos_resources("actsregisterjserrortest_resources") {
sources = [ "entry/src/main/resources" ] sources = [ "entry/src/main/resources" ]
hap_profile = "entry/src/main/config.json" deps = [ ":actsregisterjserrortest_app_profile" ]
hap_profile = "entry/src/main/module.json"
} }
{
"description": "Configuration for aceceshi Tests",
"driver": {
"type": "OHJSUnitTest",
"test-timeout": "600000",
"bundle-name": "com.example.actsregisterjserrortest",
"module-name": "entry_test",
"shell-timeout": "600000"
},
"kits": [
{
"test-file-name": [
"ActsRegisterJsErrorTest.hap",
"ActsRegisterJsErrorRely.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "ShellKit",
"run-command": [
"power-shell wakeup",
"power-shell setmode 602",
"hilog -Q pidoff",
"hilog -Q domainoff",
"hilog -b D",
"setenforce 0"
]
}
]
}
\ No newline at end of file
/*
* Copyright (c) 2023 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 hilog from '@ohos.hilog';
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 it',
'-s level', '-s testType', '-s size', '-s timeout',
'-s dryRun'
])
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams = `${targetParams} ${key} ${parameters[key]}`
}
}
return targetParams.trim()
}
async function onAbilityCreateCallback() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback');
}
async function addAbilityMonitorCallback(err: any) {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? '');
}
export default class OpenHarmonyTestRunner implements TestRunner {
constructor() {
}
onPrepare() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare ');
}
async onRun() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run');
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility'
let lMonitor = {
abilityName: testAbilityName,
onAbilityCreate: onAbilityCreateCallback,
};
abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback)
var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters)
var debug = abilityDelegatorArguments.parameters['-D']
if (debug == 'true')
{
cmd += ' -D'
}
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd);
abilityDelegator.executeShellCommand(cmd,
(err: any, d: any) => {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? '');
hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? '');
hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? '');
})
hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end');
}
}
\ No newline at end of file
/*
* Copyright (c) 2023 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 '@ohos/hypium'
import ErrorManager from "@ohos.app.ability.errorManager"
import commonEvent from '@ohos.commonEvent'
const CASE_TIME_OUT=5000;
var ACTS_Register = {
events: ["ACTS_RegisterEvent_First", "ACTS_RegisterEvent_Second"]
};
export default function abilityTest() {
describe('ActsAbilityTest', function () {
let observer;
beforeAll(function () {
observer = {
onUnhandledException(strMsg){
console.info("====>Acts_RegisterJsErrorCallback onUnhandledException Message: " + strMsg);
},
onException(errObject){
console.info("====>Acts_RegisterJsErrorCallback onException Message: " + errObject);
}
}
})
/*
* @tc.number: Acts_RegisterJsErrorCallback_0100
* @tc.name: JsError callback enhancement
* @tc.desc: Js registers onUnhandledException callback to listen. There is a callback notification when
* JS is abnormal.
*/
it('Acts_RegisterJsErrorCallback_0100',0, async function (done) {
let subscriber;
let flag = false;
console.info("====>Acts_RegisterJsErrorCallback_0100 start");
commonEvent.createSubscriber(ACTS_Register).then(async (data) => {
console.debug("====>Acts_RegisterJsErrorCallback_0100 Create Subscribe");
subscriber = data;
commonEvent.subscribe(subscriber, subscribeCallBack);
globalThis.abilityContext.startAbility(
{
bundleName: "com.example.actsregisterjserrorrely",
abilityName: "EntryAbility",
action: "Acts_RegisterJsErrorCallback_0100"
},(err)=>{
console.debug("====>Acts_RegisterJsErrorCallback_0100 startAbility err: "+JSON.stringify(err));
expect(err.code).assertEqual(0);
})
})
function subscribeCallBack(err, data) {
console.debug("====>Acts_RegisterJsErrorCallback_0100 subscribeCallBack data: " + JSON.stringify(data));
if(data.event == "ACTS_RegisterEvent_First") {
flag = true;
expect(data.parameters.message).assertContain("Error message:Cannot read property terminateSelf");
commonEvent.unsubscribe(subscriber, unSubscribeCallback);
}
}
function unSubscribeCallback() {
console.debug("====>Acts_RegisterJsErrorCallback_0100 unSubscribeCallback");
setTimeout(()=>{
done();
}, 800);
}
setTimeout(()=>{
if(flag==false){
expect().assertFail();
commonEvent.unsubscribe(subscriber, unSubscribeCallback);
}
},CASE_TIME_OUT)
})
/*
* @tc.number: Acts_RegisterJsErrorCallback_0200
* @tc.name: JsError callback enhancement
* @tc.desc: Js registers onUnhandledException and onException callback to listen. There is a callback
* notification when JS is abnormal.
*/
it('Acts_RegisterJsErrorCallback_0200',0, async function (done) {
let subscriber;
let flag = false;
console.info("====>Acts_RegisterJsErrorCallback_0200 start")
commonEvent.createSubscriber(ACTS_Register).then(async (data) => {
console.debug("====>Acts_RegisterJsErrorCallback_0200 Create Subscribe");
subscriber = data;
commonEvent.subscribe(subscriber, subscribeCallBack);
globalThis.abilityContext.startAbility(
{
bundleName: "com.example.actsregisterjserrorrely",
abilityName: "EntryAbility",
action: "Acts_RegisterJsErrorCallback_0200"
},(err)=>{
console.debug("====>Acts_RegisterJsErrorCallback_0200 startAbility err: "+JSON.stringify(err));
expect(err.code).assertEqual(0);
})
})
var msg = {"ACTS_RegisterEvent_First": false, "ACTS_RegisterEvent_Second": false}
function subscribeCallBack(err, data) {
if (data.event === 'ACTS_RegisterEvent_First') {
console.debug("====>Acts_RegisterJsErrorCallback_0200 subscribeCallBack First data: " + JSON.stringify(data));
expect(data.parameters.message).assertContain("Error message:Cannot read property terminateSelf");
msg["ACTS_RegisterEvent_First"] = true;
} else if (data.event === 'ACTS_RegisterEvent_Second') {
console.debug("====>Acts_RegisterJsErrorCallback_0200 subscribeCallBack Second data: " +
JSON.stringify(data));
expect(data.parameters.message.name).assertEqual("TypeError");
expect(data.parameters.message.message).assertEqual("Cannot read property terminateSelf of undefined");
expect(data.parameters.message.stack).assertContain("at anonymous");
msg["ACTS_RegisterEvent_Second"] = true;
}
if (msg["ACTS_RegisterEvent_First"] == true && msg["ACTS_RegisterEvent_Second"] == true) {
flag = true;
commonEvent.unsubscribe(subscriber, unSubscribeCallback);
}
}
function unSubscribeCallback() {
setTimeout(()=>{
console.debug("====>Acts_RegisterJsErrorCallback_0200 unSubscribeCallback");
done();
}, 800);
}
setTimeout(()=>{
if(flag==false){
expect().assertFail();
commonEvent.unsubscribe(subscriber, unSubscribeCallback);
}
},CASE_TIME_OUT)
})
/*
* @tc.number: Acts_RegisterJsErrorCallback_0300
* @tc.name: JsError callback enhancement
* @tc.desc: When registering JS exception listening interface parameter type is undefined, returns an error.
*/
it('Acts_RegisterJsErrorCallback_0300',0, async function (done) {
console.info("====>Acts_RegisterJsErrorCallback_0300 start");
try {
ErrorManager.on(undefined, observer);
expect().assertFail();
done();
} catch (err) {
console.info("====>Acts_RegisterJsErrorCallback_0300 catch " + JSON.stringify(err.code));
expect(err.code).assertEqual(401);
console.info("====>Acts_RegisterJsErrorCallback_0300 end");
done();
}
})
/*
* @tc.number: Acts_RegisterJsErrorCallback_0400
* @tc.name: JsError callback enhancement
* @tc.desc: When registering JS exception listening interface parameter type is null, returns an error.
*/
it('Acts_RegisterJsErrorCallback_0400',0, async function (done) {
console.info("====>Acts_RegisterJsErrorCallback_0400 start");
try {
ErrorManager.on(null, observer);
expect().assertFail();
done();
} catch (err) {
console.info("====>Acts_RegisterJsErrorCallback_0400 catch " + JSON.stringify(err));
expect(err.code).assertEqual(401);
console.info("====>Acts_RegisterJsErrorCallback_0400 end");
done();
}
})
/*
* @tc.number: Acts_RegisterJsErrorCallback_0500
* @tc.name: JsError callback enhancement
* @tc.desc: When registering JS exception listening interface parameter observer is undefined, no abnormal
* error in interface execution.
*/
it('Acts_RegisterJsErrorCallback_0500',0, async function (done) {
console.info("====>Acts_RegisterJsErrorCallback_0500 start");
try {
ErrorManager.on("error", undefined);
expect(true).assertTrue();
console.info("====>Acts_RegisterJsErrorCallback_0500 end");
done();
} catch (err) {
console.info("====>Acts_RegisterJsErrorCallback_0500 catch " + JSON.stringify(err));
expect().assertFail();
done();
}
})
/*
* @tc.number: Acts_RegisterJsErrorCallback_0600
* @tc.name: JsError callback enhancement
* @tc.desc: When registering JS exception listening interface parameter observer is null, no abnormal
* error in interface execution.
*/
it('Acts_RegisterJsErrorCallback_0600',0, async function (done) {
console.info("====>Acts_RegisterJsErrorCallback_0600 start");
try {
ErrorManager.on("error", null);
expect(true).assertTrue();
console.info("====>Acts_RegisterJsErrorCallback_0600 end");
done();
} catch (err) {
console.info("====>Acts_RegisterJsErrorCallback_0600 catch " + JSON.stringify(err));
expect().assertFail();
done();
}
})
/*
* @tc.number: Acts_UnregisterJsErrorCallback_0100
* @tc.name: JsError callback enhancement
* @tc.desc: When unregistering JS exception listening interface parameter type is undefined, returns an error.
*/
it('Acts_UnregisterJsErrorCallback_0100',0, async function (done) {
console.info("====>Acts_UnregisterJsErrorCallback_0100 start");
let observerId = ErrorManager.on("error", observer);
try {
ErrorManager.off(undefined, observerId).then(()=>{
console.info("====>Acts_UnregisterJsErrorCallback_0100 success");
expect().assertFail();
done();
}).catch((err)=>{
console.info("====>Acts_UnregisterJsErrorCallback_0100 err: " + JSON.stringify(err));
expect(err.code).assertEqual(401);
done();
})
} catch (err) {
console.info("====>Acts_UnregisterJsErrorCallback_0100 catch: " + JSON.stringify(err));
expect(err.code).assertEqual(401);
console.info("====>Acts_UnregisterJsErrorCallback_0100 end");
done();
}
})
/*
* @tc.number: Acts_UnregisterJsErrorCallback_0200
* @tc.name: JsError callback enhancement
* @tc.desc: When unregistering JS exception listening interface parameter type is null, returns an error.
*/
it('Acts_UnregisterJsErrorCallback_0200',0, async function (done) {
console.info("====>Acts_UnregisterJsErrorCallback_0200 start");
let observerId = ErrorManager.on("error", observer);
try {
ErrorManager.off(null, observerId).then(()=>{
console.info("====>Acts_UnregisterJsErrorCallback_0200 success");
expect().assertFail();
done();
}).catch((err)=>{
console.info("====>Acts_UnregisterJsErrorCallback_0200 err: " + JSON.stringify(err));
expect(err.code).assertEqual(401);
done();
})
} catch (err) {
console.info("====>Acts_UnregisterJsErrorCallback_0200 catch: " + JSON.stringify(err));
expect(err.code).assertEqual(401);
console.info("====>Acts_UnregisterJsErrorCallback_0200 end");
done();
}
})
/*
* @tc.number: Acts_UnregisterJsErrorCallback_0300
* @tc.name: JsError callback enhancement
* @tc.desc: When unregistering JS exception listening interface parameter observerId is undefined, returns error.
*/
it('Acts_UnregisterJsErrorCallback_0300',0, async function (done) {
console.info("====>Acts_UnregisterJsErrorCallback_0300 start");
ErrorManager.off("error", undefined).then(()=>{
console.info("====>Acts_UnregisterJsErrorCallback_0300 success");
expect().assertFail();
done();
}).catch((err)=>{
console.info("====>Acts_UnregisterJsErrorCallback_0300 err: " + JSON.stringify(err));
expect(err.code).assertEqual(401);
done();
})
})
/*
* @tc.number: Acts_UnregisterJsErrorCallback_0400
* @tc.name: JsError callback enhancement
* @tc.desc: When unregistering JS exception listening interface parameter observerId is null, returns error.
*/
it('Acts_UnregisterJsErrorCallback_0400',0, async function (done) {
console.info("====>Acts_UnregisterJsErrorCallback_0400 start");
ErrorManager.off("error", null).then(()=>{
console.info("====>Acts_UnregisterJsErrorCallback_0400 success");
expect().assertFail();
done();
}).catch((err)=>{
console.info("====>Acts_UnregisterJsErrorCallback_0400 err: " + JSON.stringify(err));
expect(err.code).assertEqual(401);
done();
})
})
/*
* @tc.number: Acts_UnregisterJsErrorCallback_0500
* @tc.name: JsError callback enhancement
* @tc.desc: When unregistering JS exception listening interface parameter observerId is -1, returns error.
*/
it('Acts_UnregisterJsErrorCallback_0500',0, async function (done) {
console.info("====>Acts_UnregisterJsErrorCallback_0500 start");
ErrorManager.off("error", -1).then(()=>{
console.info("====>Acts_UnregisterJsErrorCallback_0500 success");
expect().assertFail();
done();
}).catch((err)=>{
console.info("====>Acts_UnregisterJsErrorCallback_0500 err: " + JSON.stringify(err));
expect(err.code).assertEqual(401);
done();
})
})
/*
* @tc.number: Acts_UnregisterJsErrorCallback_0600
* @tc.name: JsError callback enhancement
* @tc.desc: When unregistering JS exception listening interface parameter observerId is 10000, returns error.
*/
it('Acts_UnregisterJsErrorCallback_0600',0, async function (done) {
console.info("====>Acts_UnregisterJsErrorCallback_0600 start");
ErrorManager.off("error", 10000).then(()=>{
console.info("====>Acts_UnregisterJsErrorCallback_0600 success");
expect().assertFail();
done();
}).catch((err)=>{
console.info("====>Acts_UnregisterJsErrorCallback_0600 err: " + JSON.stringify(err));
expect(err.code).assertEqual(16000003);
done();
})
})
/*
* @tc.number: Acts_UnregisterJsErrorCallback_0700
* @tc.name: JsError callback enhancement
* @tc.desc: When the parameter objectId of the unregistered JS exception listening interface is the correct
* registered value, the interface executes correctly.
*/
it('Acts_UnregisterJsErrorCallback_0700',0, async function (done) {
console.info("====>Acts_UnregisterJsErrorCallback_0700 start");
let observerId = ErrorManager.on("error", observer);
try {
ErrorManager.off("error", observerId).then(()=>{
console.info("====>Acts_UnregisterJsErrorCallback_0700 end");
expect(true).assertTrue();
done();
}).catch((err)=>{
console.info("====>Acts_UnregisterJsErrorCallback_0700 err: " + JSON.stringify(err));
expect().assertFail();
done();
})
} catch (err) {
console.info("====>Acts_UnregisterJsErrorCallback_0700 catch: " + JSON.stringify(err));
expect().assertFail();
done();
}
})
/*
* @tc.number: Acts_UnregisterJsErrorCallback_0800
* @tc.name: JsError callback enhancement
* @tc.desc: When unregistered as the correct registered value, the interface executes correctly and the JS
* layer does not trigger an exception error callback.
*/
it('Acts_UnregisterJsErrorCallback_0800',0, async function (done) {
let subscriber;
let flag = false;
console.info("====>Acts_UnregisterJsErrorCallback_0800 start")
commonEvent.createSubscriber(ACTS_Register).then(async (data) => {
console.debug("====>Acts_UnregisterJsErrorCallback_0800 Create Subscribe");
subscriber = data;
commonEvent.subscribe(subscriber, subscribeCallBack);
globalThis.abilityContext.startAbility(
{
bundleName: "com.example.actsregisterjserrorrely",
abilityName: "EntryAbility",
action: "Acts_UnregisterJsErrorCallback_0800"
},(err)=>{
console.debug("====>Acts_UnregisterJsErrorCallback_0800 startAbility err: "+JSON.stringify(err));
expect(err.code).assertEqual(0);
})
})
var msg = {"ACTS_RegisterEvent_First": false, "ACTS_RegisterEvent_Second": false}
function subscribeCallBack(err, data) {
if (data.event === 'ACTS_RegisterEvent_First') {
console.debug("====>Acts_UnregisterJsErrorCallback_0800 subscribeCallBack First data: " +
JSON.stringify(data));
expect(data.parameters.message).assertContain("Error message:Cannot read property terminateSelf");
msg["ACTS_RegisterEvent_First"] = true;
} else if (data.event === 'ACTS_RegisterEvent_Second') {
console.debug("====>Acts_UnregisterJsErrorCallback_0800 subscribeCallBack Second data: " +
JSON.stringify(data));
expect(data.parameters.message.name).assertEqual("TypeError");
expect(data.parameters.message.message).assertEqual("Cannot read property terminateSelf of undefined");
expect(data.parameters.message.stack).assertContain("at anonymous");
msg["ACTS_RegisterEvent_Second"] = true;
}
if (msg["ACTS_RegisterEvent_First"] == true && msg["ACTS_RegisterEvent_Second"] == true) {
flag = true;
commonEvent.unsubscribe(subscriber, unSubscribeCallback);
}
}
function unSubscribeCallback() {
setTimeout(() => {
console.debug("====>Acts_UnregisterJsErrorCallback_0800 unSubscribeCallback");
done();
}, 800);
}
setTimeout(()=>{
if(flag==false){
expect().assertFail();
commonEvent.unsubscribe(subscriber, unSubscribeCallback);
}
},CASE_TIME_OUT)
})
})
}
\ No newline at end of file
/* /*
* Copyright (C) 2022 Huawei Device Co., Ltd. * Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
export default { import abilityTest from './Ability.test'
onCreate() {
console.info('Application onCreate') export default function testsuite() {
}, abilityTest()
onDestroy() {
console.info('Application onDestroy')
},
} }
\ No newline at end of file
/*
* Copyright (c) 2023 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 hilog from '@ohos.hilog';
import Ability from '@ohos.app.ability.UIAbility'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
import Window from '@ohos.window'
export default class TestAbility extends Ability {
onCreate(want, launchParam) {
globalThis.abilityContext = this.context;
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate');
hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? '');
hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? '');
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!');
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}
onDestroy() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy');
}
onWindowStageCreate(windowStage: Window.WindowStage) {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate');
windowStage.loadContent('testability/pages/Index', (err, data) => {
if (err.code) {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.ERROR);
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
return;
}
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s',
JSON.stringify(data) ?? '');
});
}
onWindowStageDestroy() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy');
}
onForeground() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground');
}
onBackground() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground');
}
}
\ No newline at end of file
/* /*
* Copyright (C) 2022 Huawei Device Co., Ltd. * Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import {Core} from '@ohos/hypium' import hilog from '@ohos.hilog';
@Entry @Entry
@Component @Component
struct Index { struct Index {
aboutToAppear() { aboutToAppear() {
console.info('onShow finish') hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
const core = Core.getInstance() hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear');
core.init() }
const configService = core.getDefaultService('config') @State message: string = 'Hello World'
configService.setConfig(this) build() {
core.execute() Row() {
} Column() {
Text(this.message)
build() { .fontSize(50)
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { .fontWeight(FontWeight.Bold)
Text('Hello World') Button() {
.fontSize(50) Text('next page')
.fontWeight(FontWeight.Bold) .fontSize(20)
} .fontWeight(FontWeight.Bold)
.width('100%') }.type(ButtonType.Capsule)
.height('100%') .margin({
} top: 20
} })
\ No newline at end of file .backgroundColor('#0D9FFB')
.width('35%')
.height('5%')
.onClick(()=>{
})
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"module": {
"name": "entry_test",
"type": "feature",
"description": "$string:module_test_desc",
"mainElement": "TestAbility",
"deviceTypes": [
"default",
"tablet"
],
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:test_pages",
"abilities": [
{
"name": "TestAbility",
"srcEntrance": "./ets/testability/TestAbility.ets",
"description": "$string:TestAbility_desc",
"icon": "$media:icon",
"label": "$string:TestAbility_label",
"visible": true,
"startWindowIcon": "$media:icon",
"startWindowBackground": "$color:start_window_background",
"skills": [
{
"actions": [
"action.system.home"
],
"entities": [
"entity.system.home"
]
}
]
}
],
"requestPermissions": [
{
"name": "ohos.permission.START_ABILITIES_FROM_BACKGROUND"
}
]
}
}
{
"color": [
{
"name": "start_window_background",
"value": "#FFFFFF"
}
]
}
\ No newline at end of file
{
"string": [
{
"name": "module_test_desc",
"value": "test ability description"
},
{
"name": "TestAbility_desc",
"value": "the test ability"
},
{
"name": "TestAbility_label",
"value": "test label"
}
]
}
\ No newline at end of file
# Copyright (c) 2023 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")
group("registerjserror") {
testonly = true
if (is_standard_system) {
deps = [
"ActsRegisterJsErrorRely:ActsRegisterJsErrorRely",
"ActsRegisterJsErrorTest:ActsRegisterJsErrorTest",
]
}
}
{
"app": {
"bundleName": "com.acts.stopserviceextensiontest",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"distributedNotificationEnabled": true,
"keepAlive" : true,
"singleUser": true,
"minAPIVersion": 10,
"targetAPIVersion": 10,
"car": {
"apiCompatibleVersion": 10,
"singleUser": false
}
}
}
# Copyright (c) 2023 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_hap_assist_suite("ActsStopServiceExtensionRely") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
":actsstopserviceextensionrely_js_assets",
":actsstopserviceextensionrely_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsStopServiceExtensionRely"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("actsstopserviceextensionrely_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("actsstopserviceextensionrely_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("actsstopserviceextensionrely_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":actsstopserviceextensionrely_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
/*
* Copyright (c) 2023 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 hilog from '@ohos.hilog';
import Ability from '@ohos.app.ability.UIAbility'
import Window from '@ohos.window'
export default class EntryAbility extends Ability {
onCreate(want, launchParam) {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? '');
hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:' + JSON.stringify(launchParam) ?? '');
}
onDestroy() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
}
onWindowStageCreate(windowStage: Window.WindowStage) {
// Main window is created, set main page for this ability
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
windowStage.loadContent('pages/Index', (err, data) => {
if (err.code) {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.ERROR);
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
return;
}
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? '');
});
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
}
onForeground() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
}
onBackground() {
// Ability has back to background
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
}
}
/*
* Copyright (c) 2023 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 Index {
@State message: string = 'Hello World'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
/*
* Copyright (c) 2023 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 ServiceExtensionAbility from '@ohos.app.ability.ServiceExtensionAbility'
import rpc from '@ohos.rpc';
import commonEvent from '@ohos.commonEvent'
let message;
let commonEventData={
parameters:{
message:message,
}
}
class StubTest extends rpc.RemoteObject {
constructor(des) {
super(des)
}
onRemoteRequest(code, data, reply, option) {
console.info('ServiceAbility onRemoteRequest');
if (code === 1) {
let op1 = data.readInt();
let op2 = data.readInt();
reply.writeInt(op1 + op2);
console.info('ServiceAbility op1:' + op1 + ' op2:' + op2);
}
return true;
}
}
let strAction = '';
let remoteOBJ = new StubTest("test");
export default class ServiceAbility extends ServiceExtensionAbility {
onCreate(want){
let disConnect = false;
strAction = want.action;
console.info('ServiceAbility onCreate');
commonEventData.parameters.message = want;
let NewWant = {
bundleName: "com.acts.stopserviceextensiontest",
abilityName: "ServiceAbilitySec",
action: strAction
}
let options = {
onConnect: async function (element: any, proxy: any) {
console.info("Acts_StopServiceExtension_0600 service onConnect success!!!")
console.info('Acts_StopServiceExtension_0600 service onConnect element : ' + JSON.stringify(element));
console.info('Acts_StopServiceExtension_0600 service onConnect proxy : ' + JSON.stringify(proxy));
},
onDisconnect: async function (element1: any) {
disConnect = true;
console.info("Acts_StopServiceExtension_0600 service onDisconnect success!!!")
console.info('Acts_StopServiceExtension_0600 service onDisconnect ele : ' + JSON.stringify(element1));
},
onFailed: async function (code: any) {
console.info("Acts_StopServiceExtension_0600 service onFailed!!!")
console.info('Acts_StopServiceExtension_0600 service onFailed errCode : ' + JSON.stringify(code));
},
}
if (strAction == "Acts_StopServiceExtension_0100" || strAction == "Acts_StopServiceExtension_0300" ||
strAction == "Acts_StopServiceExtension_0500" || strAction == "Acts_StopServiceExtension_1700") {
commonEvent.publish("ACTS_StopEvent_First", commonEventData, (err) => {
console.info("====>" + strAction + " publish err: " + JSON.stringify(err));
})
}
if (strAction == "Acts_StopServiceExtension_0200") {
setTimeout(()=>{
this.context.startAbility(NewWant, (err)=>{
console.info("====>" + strAction + " startAbility serviceExtension err: " + JSON.stringify(err));
setTimeout(()=>{
this.context.stopServiceExtensionAbility(NewWant, (err)=>{
console.info("====>" + strAction + " stop ServiceAbilitySec err: " +
JSON.stringify(err));
commonEventData.parameters.message = err.code;
commonEvent.publish("ACTS_StopEvent_First", commonEventData, (err) => {
console.info("====>" + strAction + " First publish err: " + JSON.stringify(err));
})
})
}, 200)
})
}, 100)
}
if (strAction == "Acts_StopServiceExtension_0400") {
setTimeout(()=>{
this.context.startServiceExtensionAbility(NewWant, (err)=>{
console.info("====>" + strAction + " startAbility serviceExtension err: " + JSON.stringify(err));
setTimeout(()=>{
this.context.stopServiceExtensionAbility(NewWant, (err)=>{
console.info("====>" + strAction + " stop ServiceAbilitySec err: " +
JSON.stringify(err));
commonEventData.parameters.message = err.code;
commonEvent.publish("ACTS_StopEvent_First", commonEventData, (err) => {
console.info("====>" + strAction + " First publish err: " + JSON.stringify(err));
})
})
}, 200)
})
}, 100)
}
if (strAction == "Acts_StopServiceExtension_0600") {
setTimeout(()=>{
let data = this.context.connectServiceExtensionAbility(NewWant, options);
console.info("====>" + strAction + " connect ServiceAbilitySec: " + JSON.stringify(data));
setTimeout(() => {
this.context.stopServiceExtensionAbility(NewWant, (err) => {
console.info("====>" + strAction + " stop ServiceAbilitySec err: " +
JSON.stringify(err));
commonEventData.parameters.message = err.code;
commonEvent.publish("ACTS_StopEvent_First", commonEventData, (err) => {
console.info("====>" + strAction + " First publish err: " + JSON.stringify(err));
commonEventData.parameters.message = disConnect;
commonEvent.publish("ACTS_StopEvent_Third", commonEventData, (err) => {
console.info("====>" + strAction + " First publish err: " + JSON.stringify(err));
})
})
})
}, 200)
}, 100)
}
if (strAction == "Acts_StopServiceExtension_0800") {
setTimeout(()=>{
this.context.stopServiceExtensionAbility({
deviceId: "abcdefg12345678",
bundleName: "com.acts.stopserviceextensiontest",
abilityName: "ServiceAbilitySec",
action: strAction
}, (err)=>{
console.info("====>" + strAction + " stop ServiceAbilitySec err: " + JSON.stringify(err));
commonEventData.parameters.message = err.code;
commonEvent.publish("ACTS_StopEvent_First", commonEventData, (err) => {
console.info("====>" + strAction + " publish err: " + JSON.stringify(err));
})
})
}, 100)
}
if (strAction == "Acts_StopServiceExtension_1800") {
setTimeout(()=>{
this.context.stopServiceExtensionAbility({
deviceId: undefined,
bundleName: "com.acts.stopserviceextensiontest",
abilityName: "ServiceAbilitySec",
action: strAction
}, (err)=>{
console.info("====>" + strAction + " stop ServiceAbilitySec err: " + JSON.stringify(err));
commonEventData.parameters.message = err.code;
commonEvent.publish("ACTS_StopEvent_First", commonEventData, (err) => {
console.info("====>" + strAction + " publish err: " + JSON.stringify(err));
})
})
}, 100)
}
}
onDestroy() {
console.info('ServiceAbility onDestroy');
}
onRequest(want, startId) {
console.info('ServiceAbility onRequest');
}
onConnect(want) {
console.info('ServiceAbility onConnect');
return remoteOBJ;
}
onDisconnect(want) {
console.info('ServiceAbility onDisconnect');
}
onReconnect(want) {
console.info('ServiceAbility onReconnect');
}
onConfigurationUpdate(newConfig) {
console.info('ServiceAbility onConfigurationUpdate');
}
onDump(params) {
console.info('ServiceAbility onDump');
return params;
}
};
\ No newline at end of file
/*
* Copyright (c) 2023 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 ServiceExtensionAbility from '@ohos.app.ability.ServiceExtensionAbility'
import rpc from '@ohos.rpc';
import commonEvent from '@ohos.commonEvent'
let message;
let commonEventData={
parameters:{
message:message,
}
}
class StubTest extends rpc.RemoteObject {
constructor(des) {
super(des)
}
onRemoteRequest(code, data, reply, option) {
console.info('ServiceAbilitySec onRemoteRequest');
if (code === 1) {
let op1 = data.readInt();
let op2 = data.readInt();
reply.writeInt(op1 + op2);
console.info('ServiceAbilitySec op1:' + op1 + ' op2:' + op2);
}
return true;
}
}
let strAction = '';
let remoteOBJ = new StubTest("test");
export default class ServiceAbilitySec extends ServiceExtensionAbility {
onCreate(want){
strAction = want.action;
console.info('ServiceAbilitySec onCreate');
commonEventData.parameters.message = want;
if (strAction == "Acts_StopServiceExtension_0200" || strAction == "Acts_StopServiceExtension_0400" ||
strAction == "Acts_StopServiceExtension_0600") {
commonEvent.publish("ACTS_StopEvent_Second", commonEventData, (err) => {
console.info("====>" + strAction + " Second publish err: " + JSON.stringify(err));
})
}
}
onDestroy() {
console.info('ServiceAbilitySec onDestroy');
}
onRequest(want, startId) {
console.info('ServiceAbilitySec onRequest');
}
onConnect(want) {
console.info('ServiceAbilitySec onConnect');
return remoteOBJ;
}
onDisconnect(want) {
console.info('ServiceAbilitySec onDisconnect');
}
onReconnect(want) {
console.info('ServiceAbility onReconnect');
}
onConfigurationUpdate(newConfig) {
console.info('ServiceAbility onConfigurationUpdate');
}
onDump(params) {
console.info('ServiceAbility onDump');
return params;
}
};
\ No newline at end of file
{
"module": {
"name": "entry",
"type": "entry",
"description": "$string:module_desc",
"mainElement": "EntryAbility",
"deviceTypes": [
"default",
"tablet"
],
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:main_pages",
"abilities": [
{
"name": "EntryAbility",
"srcEntrance": "./ets/entryability/EntryAbility.ts",
"description": "$string:EntryAbility_desc",
"icon": "$media:icon",
"label": "$string:EntryAbility_label",
"startWindowIcon": "$media:icon",
"startWindowBackground": "$color:start_window_background",
"visible": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
]
}
],
"extensionAbilities": [
{
"name": "ServiceAbility",
"srcEntrance": "./ets/serviceability/ServiceAbility.ts",
"label": "$string:ServiceAbility_label",
"description": "$string:ServiceAbility_desc",
"type": "service"
},
{
"name": "ServiceAbilitySec",
"srcEntrance": "./ets/serviceabilitySec/ServiceAbilitySec.ts",
"label": "$string:ServiceAbilitySec_desc",
"description": "$string:ServiceAbilitySec_desc",
"type": "service"
}
]
}
}
\ No newline at end of file
{
"color": [
{
"name": "start_window_background",
"value": "#FFFFFF"
}
]
}
\ No newline at end of file
{
"string": [
{
"name": "module_desc",
"value": "module description"
},
{
"name": "EntryAbility_desc",
"value": "description"
},
{
"name": "EntryAbility_label",
"value": "label"
},
{
"name": "ServiceAbility_desc",
"value": "service_description"
},
{
"name": "ServiceAbility_label",
"value": "service_label"
},
{
"name": "ServiceAbilitySec_desc",
"value": "service_description"
},
{
"name": "ServiceAbilitySec_label",
"value": "service_label"
}
]
}
\ No newline at end of file
{
"string": [
{
"name": "module_desc",
"value": "module description"
},
{
"name": "EntryAbility_desc",
"value": "description"
},
{
"name": "EntryAbility_label",
"value": "ActsStopServiceExtensionRely"
},
{
"name": "ServiceAbility_desc",
"value": "service_description"
},
{
"name": "ServiceAbility_label",
"value": "service_label"
},
{
"name": "ServiceAbilitySec_desc",
"value": "service_description"
},
{
"name": "ServiceAbilitySec_label",
"value": "service_label"
}
]
}
\ No newline at end of file
{
"string": [
{
"name": "module_desc",
"value": "模块描述"
},
{
"name": "EntryAbility_desc",
"value": "description"
},
{
"name": "EntryAbility_label",
"value": "ActsStopServiceExtensionRely"
},
{
"name": "ServiceAbility_desc",
"value": "service_description"
},
{
"name": "ServiceAbility_label",
"value": "service_label"
},
{
"name": "ServiceAbilitySec_desc",
"value": "service_description"
},
{
"name": "ServiceAbilitySec_label",
"value": "service_label"
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "com.acts.stopserviceextensiontest",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"distributedNotificationEnabled": true,
"keepAlive" : true,
"singleUser": true,
"minAPIVersion": 10,
"targetAPIVersion": 10,
"car": {
"apiCompatibleVersion": 10,
"singleUser": false
}
}
}
# Copyright (c) 2023 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("ActsStopServiceExtensionTest") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
":actsstopserviceextensiontest_js_assets",
":actsstopserviceextensiontest_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsStopServiceExtensionTest"
subsystem_name = "ability"
part_name = "ability_runtime"
}
ohos_app_scope("actsstopserviceextensiontest_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("actsstopserviceextensiontest_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("actsstopserviceextensiontest_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":actsstopserviceextensiontest_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
{
"description": "Configuration for aceceshi Tests",
"driver": {
"type": "OHJSUnitTest",
"test-timeout": "600000",
"bundle-name": "com.acts.stopserviceextensiontest",
"module-name": "entry_test",
"shell-timeout": "600000"
},
"kits": [
{
"test-file-name": [
"ActsStopServiceExtensionTest.hap",
"ActsStopServiceExtensionRely.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "ShellKit",
"run-command": [
"power-shell wakeup",
"power-shell setmode 602",
"hilog -Q pidoff",
"hilog -Q domainoff",
"hilog -b D",
"setenforce 0"
]
}
]
}
\ No newline at end of file
/*
* Copyright (c) 2023 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 hilog from '@ohos.hilog';
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 it',
'-s level', '-s testType', '-s size', '-s timeout',
'-s dryRun'
])
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams = `${targetParams} ${key} ${parameters[key]}`
}
}
return targetParams.trim()
}
async function onAbilityCreateCallback() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback');
}
async function addAbilityMonitorCallback(err: any) {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? '');
}
export default class OpenHarmonyTestRunner implements TestRunner {
constructor() {
}
onPrepare() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare ');
}
async onRun() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run');
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility'
let lMonitor = {
abilityName: testAbilityName,
onAbilityCreate: onAbilityCreateCallback,
};
abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback)
var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters)
var debug = abilityDelegatorArguments.parameters['-D']
if (debug == 'true')
{
cmd += ' -D'
}
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd);
abilityDelegator.executeShellCommand(cmd,
(err: any, d: any) => {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? '');
hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? '');
hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? '');
})
hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end');
}
}
\ No newline at end of file
/*
* Copyright (c) 2023 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 '@ohos/hypium'
import commonEvent from '@ohos.commonEvent'
const CASE_TIME_OUT=5000;
var ACTS_StopServiceExtension = {
events: ["ACTS_StopEvent_First", "ACTS_StopEvent_Second", "ACTS_StopEvent_Third"]
};
export default function abilityTest() {
describe('ActsAbilityTest', function () {
/*
* @tc.number: Acts_StopServiceExtension_0100
* @tc.name: Distributed Component Support Remote Stop Extension
* @tc.desc: Local device usage StopServiceExtensionAbility Stop the ServiceExtension application
* started by startAbility.
*/
it('Acts_StopServiceExtension_0100', 0, async function (done) {
let subscriber;
let flag = false;
let want = {
bundleName: "com.acts.stopserviceextensiontest",
abilityName: "ServiceAbility",
action: "Acts_StopServiceExtension_0100"
}
console.info("====>Acts_StopServiceExtension_0100 start");
commonEvent.createSubscriber(ACTS_StopServiceExtension).then(async (data) => {
console.info("====>Acts_StopServiceExtension_0100 Create Subscribe");
subscriber = data;
commonEvent.subscribe(subscriber, subscribeCallBack);
globalThis.abilityContext.startAbility(want, (err) => {
console.info("====>Acts_StopServiceExtension_0100 startAbility err: " + JSON.stringify(err));
expect(err.code).assertEqual(0);
})
})
function subscribeCallBack(err, data) {
console.info("====>Acts_StopServiceExtension_0100 subscribeCallBack data: " + JSON.stringify(data));
if (data.event == "ACTS_StopEvent_First") {
flag = true;
globalThis.abilityContext.stopServiceExtensionAbility(want, (err) => {
console.info("====>Acts_StopServiceExtension_0100 stopServiceExtensionAbility err: " + JSON.stringify(err));
expect(err.code).assertEqual(0);
commonEvent.unsubscribe(subscriber, unSubscribeCallback);
})
}
}
function unSubscribeCallback() {
console.info("====>Acts_StopServiceExtension_0100 unSubscribeCallback");
done();
}
setTimeout(() => {
if (flag == false) {
expect().assertFail();
commonEvent.unsubscribe(subscriber, unSubscribeCallback);
}
}, CASE_TIME_OUT)
})
/*
* @tc.number: Acts_StopServiceExtension_0200
* @tc.name: Distributed Component Support Remote Stop Extension
* @tc.desc: Local device usage StopServiceExtensionAbility Stop the ServiceExtension application
* started by startAbility.
*/
it('Acts_StopServiceExtension_0200', 0, async function (done) {
let subscriber;
let flag = false;
let count = 0;
console.info("====>Acts_StopServiceExtension_0200 start");
commonEvent.createSubscriber(ACTS_StopServiceExtension).then(async (data) => {
console.info("====>Acts_StopServiceExtension_0200 Create Subscribe");
subscriber = data;
commonEvent.subscribe(subscriber, subscribeCallBack);
globalThis.abilityContext.startAbility(
{
bundleName: "com.acts.stopserviceextensiontest",
abilityName: "ServiceAbility",
action: "Acts_StopServiceExtension_0200"
}, (err) => {
console.info("====>Acts_StopServiceExtension_0200 startAbility err: " + JSON.stringify(err));
expect(err.code).assertEqual(0);
})
})
function subscribeCallBack(err, data) {
if (data.event == "ACTS_StopEvent_First") {
console.info("====>Acts_StopServiceExtension_0200 subscribeCallBack First data: " + JSON.stringify(data));
expect(data.parameters.message).assertEqual(0);
count++;
} else if (data.event == "ACTS_StopEvent_Second") {
console.info("====>Acts_StopServiceExtension_0200 subscribeCallBack Second data: " + JSON.stringify(data));
expect(data.parameters.message.bundleName).assertEqual('com.acts.stopserviceextensiontest');
expect(data.parameters.message.abilityName).assertEqual('ServiceAbilitySec');
count++;
}
if (count == 2) {
flag = true;
commonEvent.unsubscribe(subscriber, unSubscribeCallback);
}
}
function unSubscribeCallback() {
globalThis.abilityContext.stopServiceExtensionAbility({
bundleName: "com.acts.stopserviceextensiontest",
abilityName: "ServiceAbility"
}, (err) => {
console.info("====>Acts_StopServiceExtension_0200 stop ServiceAbility err: " + JSON.stringify(err));
expect(err.code).assertEqual(0);
console.info("====>Acts_StopServiceExtension_0200 unSubscribeCallback");
done();
})
}
setTimeout(() => {
if (flag == false) {
expect().assertFail();
commonEvent.unsubscribe(subscriber, unSubscribeCallback);
}
}, CASE_TIME_OUT)
})
/*
* @tc.number: Acts_StopServiceExtension_0300
* @tc.name: Distributed Component Support Remote Stop Extension
* @tc.desc: Local device usage StopServiceExtensionAbility Stop the ServiceExtension application
* started by startServiceExtensionAbility.
*/
it('Acts_StopServiceExtension_0300', 0, async function (done) {
let subscriber;
let flag = false;
let want = {
bundleName: "com.acts.stopserviceextensiontest",
abilityName: "ServiceAbility",
action: "Acts_StopServiceExtension_0300"
}
console.info("====>Acts_StopServiceExtension_0300 start");
commonEvent.createSubscriber(ACTS_StopServiceExtension).then(async (data) => {
console.info("====>Acts_StopServiceExtension_0300 Create Subscribe");
subscriber = data;
commonEvent.subscribe(subscriber, subscribeCallBack);
globalThis.abilityContext.startServiceExtensionAbility(want, (err) => {
console.info("====>Acts_StopServiceExtension_0300 startAbility err: " + JSON.stringify(err));
expect(err.code).assertEqual(0);
})
})
function subscribeCallBack(err, data) {
console.info("====>Acts_StopServiceExtension_0300 subscribeCallBack data: " + JSON.stringify(data));
if (data.event == "ACTS_StopEvent_First") {
flag = true;
globalThis.abilityContext.stopServiceExtensionAbility(want, (err) => {
console.info("====>Acts_StopServiceExtension_0300 stopServiceExtensionAbility err: " +
JSON.stringify(err));
expect(err.code).assertEqual(0);
commonEvent.unsubscribe(subscriber, unSubscribeCallback);
})
}
}
function unSubscribeCallback() {
console.info("====>Acts_StopServiceExtension_0300 unSubscribeCallback");
done();
}
setTimeout(() => {
if (flag == false) {
expect().assertFail();
commonEvent.unsubscribe(subscriber, unSubscribeCallback);
}
}, CASE_TIME_OUT)
})
/*
* @tc.number: Acts_StopServiceExtension_0400
* @tc.name: Distributed Component Support Remote Stop Extension
* @tc.desc: Local device usage StopServiceExtensionAbility Stop the ServiceExtension application
* started by startServiceExtensionAbility.
*/
it('Acts_StopServiceExtension_0400', 0, async function (done) {
let subscriber;
let flag = false;
let count = 0;
console.info("====>Acts_StopServiceExtension_0400 start");
commonEvent.createSubscriber(ACTS_StopServiceExtension).then(async (data) => {
console.info("====>Acts_StopServiceExtension_0400 Create Subscribe");
subscriber = data;
commonEvent.subscribe(subscriber, subscribeCallBack);
globalThis.abilityContext.startAbility(
{
bundleName: "com.acts.stopserviceextensiontest",
abilityName: "ServiceAbility",
action: "Acts_StopServiceExtension_0400"
}, (err) => {
console.info("====>Acts_StopServiceExtension_0400 startAbility err: " + JSON.stringify(err));
expect(err.code).assertEqual(0);
})
})
function subscribeCallBack(err, data) {
if (data.event == "ACTS_StopEvent_First") {
console.info("====>Acts_StopServiceExtension_0400 subscribeCallBack First data: " + JSON.stringify(data));
expect(data.parameters.message).assertEqual(0);
count++;
} else if (data.event == "ACTS_StopEvent_Second") {
console.info("====>Acts_StopServiceExtension_0400 subscribeCallBack Second data: " + JSON.stringify(data));
expect(data.parameters.message.bundleName).assertEqual('com.acts.stopserviceextensiontest');
expect(data.parameters.message.abilityName).assertEqual('ServiceAbilitySec');
count++;
}
if (count == 2) {
flag = true;
commonEvent.unsubscribe(subscriber, unSubscribeCallback);
}
}
function unSubscribeCallback() {
globalThis.abilityContext.stopServiceExtensionAbility({
bundleName: "com.acts.stopserviceextensiontest",
abilityName: "ServiceAbility"
}, (err) => {
console.info("====>Acts_StopServiceExtension_0400 stop ServiceAbility err: " + JSON.stringify(err));
expect(err.code).assertEqual(0);
console.info("====>Acts_StopServiceExtension_0400 unSubscribeCallback");
done();
})
}
setTimeout(() => {
if (flag == false) {
expect().assertFail();
commonEvent.unsubscribe(subscriber, unSubscribeCallback);
}
}, CASE_TIME_OUT)
})
/*
* @tc.number: Acts_StopServiceExtension_0500
* @tc.name: Distributed Component Support Remote Stop Extension
* @tc.desc: Local device usage StopServiceExtensionAbility Stop the ServiceExtension application
* started by connectServiceExtensionAbility.
*/
it('Acts_StopServiceExtension_0500', 0, async function (done) {
let subscriber;
let flag = false;
let disConnect = false;
let want = {
bundleName: "com.acts.stopserviceextensiontest",
abilityName: "ServiceAbility",
action: "Acts_StopServiceExtension_0500"
}
let options = {
onConnect: async function (element: any, proxy: any) {
console.info("Acts_StopServiceExtension_0500 service onConnect success!!!")
console.info('Acts_StopServiceExtension_0500 service onConnect element : ' + JSON.stringify(element));
console.info('Acts_StopServiceExtension_0500 service onConnect proxy : ' + JSON.stringify(proxy));
},
onDisconnect: async function (element1: any) {
disConnect = true;
console.info("Acts_StopServiceExtension_0500 service onDisconnect success!!!")
console.info('Acts_StopServiceExtension_0500 service onDisconnect ele : ' + JSON.stringify(element1));
},
onFailed: async function (code: any) {
console.info("Acts_StopServiceExtension_0500 service onFailed!!!")
console.info('Acts_StopServiceExtension_0500 service onFailed errCode : ' + JSON.stringify(code));
},
}
console.info("====>Acts_StopServiceExtension_0500 start");
commonEvent.createSubscriber(ACTS_StopServiceExtension).then(async (data) => {
console.info("====>Acts_StopServiceExtension_0500 Create Subscribe");
subscriber = data;
commonEvent.subscribe(subscriber, subscribeCallBack);
globalThis.abilityContext.connectServiceExtensionAbility(want, options, (err) => {
console.info("====>Acts_StopServiceExtension_0500 startAbility err: " + JSON.stringify(err));
expect(err.code).assertEqual(0);
})
})
function subscribeCallBack(err, data) {
console.info("====>Acts_StopServiceExtension_0500 subscribeCallBack data: " + JSON.stringify(data));
if (data.event == "ACTS_StopEvent_First") {
flag = true;
globalThis.abilityContext.stopServiceExtensionAbility(want, (err) => {
console.info("====>Acts_StopServiceExtension_0500 stopServiceExtensionAbility err: " + JSON.stringify(err));
expect(err.code).assertEqual(0);
commonEvent.unsubscribe(subscriber, unSubscribeCallback);
})
}
}
function unSubscribeCallback() {
expect(disConnect).assertTrue();
console.info("====>Acts_StopServiceExtension_0500 unSubscribeCallback");
done();
}
setTimeout(() => {
if (flag == false || disConnect == false) {
expect().assertFail();
commonEvent.unsubscribe(subscriber, unSubscribeCallback);
}
}, CASE_TIME_OUT)
})
/*
* @tc.number: Acts_StopServiceExtension_0600
* @tc.name: Distributed Component Support Remote Stop Extension
* @tc.desc: Local device usage StopServiceExtensionAbility Stop the ServiceExtension application
* started by connectServiceExtensionAbility.
*/
it('Acts_StopServiceExtension_0600', 0, async function (done) {
console.info("====>Acts_StopServiceExtension_0600 start");
let subscriber;
let flag = false;
let count = 0;
commonEvent.createSubscriber(ACTS_StopServiceExtension).then(async (data) => {
console.info("====>Acts_StopServiceExtension_0600 Create Subscribe");
subscriber = data;
commonEvent.subscribe(subscriber, subscribeCallBack);
globalThis.abilityContext.startAbility(
{
bundleName: "com.acts.stopserviceextensiontest",
abilityName: "ServiceAbility",
action: "Acts_StopServiceExtension_0600"
}, (err) => {
console.info("====>Acts_StopServiceExtension_0600 startAbility err: " + JSON.stringify(err));
expect(err.code).assertEqual(0);
})
})
function subscribeCallBack(err, data) {
if (data.event == "ACTS_StopEvent_First") {
console.info("====>Acts_StopServiceExtension_0600 subscribeCallBack First data: " + JSON.stringify(data));
expect(data.parameters.message).assertEqual(0);
count++;
} else if (data.event == "ACTS_StopEvent_Second") {
console.info("====>Acts_StopServiceExtension_0600 subscribeCallBack Second data: " + JSON.stringify(data));
expect(data.parameters.message.bundleName).assertEqual('com.acts.stopserviceextensiontest');
expect(data.parameters.message.abilityName).assertEqual('ServiceAbilitySec');
count++;
} else if (data.event == "ACTS_StopEvent_Third") {
console.info("====>Acts_StopServiceExtension_0600 subscribeCallBack Third data: " + JSON.stringify(data));
expect(data.parameters.message).assertTrue();;
count++;
}
if (count == 3) {
flag = true;
commonEvent.unsubscribe(subscriber, unSubscribeCallback);
}
}
function unSubscribeCallback() {
globalThis.abilityContext.stopServiceExtensionAbility({
bundleName: "com.acts.stopserviceextensiontest",
abilityName: "ServiceAbility"
}, (err) => {
console.info("====>Acts_StopServiceExtension_0600 stop ServiceAbility err: " + JSON.stringify(err));
expect(err.code).assertEqual(0);
console.info("====>Acts_StopServiceExtension_0600 unSubscribeCallback");
done();
})
}
setTimeout(() => {
if (flag == false) {
expect().assertFail();
commonEvent.unsubscribe(subscriber, unSubscribeCallback);
}
}, CASE_TIME_OUT)
})
/*
* @tc.number: Acts_StopServiceExtension_0700
* @tc.name: Distributed Component Support Remote Stop Extension
* @tc.desc: Calling stopServiceExtensionAbility to stop the remote device ServiceExtension application
* without distributed permissions returns an error value.
*/
it('Acts_StopServiceExtension_0700', 0, async function (done) {
console.info("====>Acts_StopServiceExtension_0700 start");
let want = {
deviceId: "abcdefg12345678",
bundleName: "com.acts.stopserviceextensiontest",
abilityName: "ServiceAbility",
action: "Acts_StopServiceExtension_0700"
}
globalThis.abilityContext.stopServiceExtensionAbility(want, (err) => {
console.info("====>Acts_StopServiceExtension_0700 stopServiceExtensionAbility err: " + JSON.stringify(err));
expect(err.code).assertEqual(401);
done();
})
})
/*
* @tc.number: Acts_StopServiceExtension_0800
* @tc.name: Distributed Component Support Remote Stop Extension
* @tc.desc: Calling stopServiceExtensionAbility to stop the remote device ServiceExtension application
* without distributed permissions returns an error value.
*/
it('Acts_StopServiceExtension_0800', 0, async function (done) {
let subscriber;
let flag = false;
console.info("====>Acts_StopServiceExtension_0800 start");
commonEvent.createSubscriber(ACTS_StopServiceExtension).then(async (data) => {
console.info("====>Acts_StopServiceExtension_0800 Create Subscribe");
subscriber = data;
commonEvent.subscribe(subscriber, subscribeCallBack);
globalThis.abilityContext.startAbility(
{
bundleName: "com.acts.stopserviceextensiontest",
abilityName: "ServiceAbility",
action: "Acts_StopServiceExtension_0800"
}, (err) => {
console.info("====>Acts_StopServiceExtension_0800 startAbility err: " + JSON.stringify(err));
expect(err.code).assertEqual(0);
})
})
function subscribeCallBack(err, data) {
console.info("====>Acts_StopServiceExtension_0800 subscribeCallBack data: " + JSON.stringify(data));
if (data.event == "ACTS_StopEvent_First") {
expect(data.parameters.message).assertEqual(401);
commonEvent.unsubscribe(subscriber, unSubscribeCallback);
}
}
function unSubscribeCallback() {
globalThis.abilityContext.stopServiceExtensionAbility({
bundleName: "com.acts.stopserviceextensiontest",
abilityName: "ServiceAbility"
}, (err) => {
console.info("====>Acts_StopServiceExtension_0800 stop ServiceAbility err: " + JSON.stringify(err));
expect(err.code).assertEqual(0);
console.info("====>Acts_StopServiceExtension_0800 unSubscribeCallback");
done();
})
}
setTimeout(() => {
if (flag == false) {
expect().assertFail();
commonEvent.unsubscribe(subscriber, unSubscribeCallback);
}
}, CASE_TIME_OUT)
})
/*
* @tc.number: Acts_StopServiceExtension_1700
* @tc.name: Distributed Component Support Remote Stop Extension
* @tc.desc: The local device does not have distributed permissions. The device ID is undefined. Call
* stopServiceExtensionAbility to stop the ServiceExtension application and return an error value.
*/
it('Acts_StopServiceExtension_1700', 0, async function (done) {
console.info("====>Acts_StopServiceExtension_1700 start");
let want = {
deviceId: undefined,
bundleName: "com.acts.stopserviceextensiontest",
abilityName: "ServiceAbility",
action: "Acts_StopServiceExtension_1700"
}
globalThis.abilityContext.stopServiceExtensionAbility(want, (err) => {
console.info("====>Acts_StopServiceExtension_1700 stopServiceExtensionAbility err: " + JSON.stringify(err));
expect(err.code).assertEqual(16000050);
done();
})
})
/*
* @tc.number: Acts_StopServiceExtension_1800
* @tc.name: Distributed Component Support Remote Stop Extension
* @tc.desc: The local device does not have distributed permissions. The device ID is undefined. Call
* stopServiceExtensionAbility to stop the ServiceExtension application and return an error value.
*/
it('Acts_StopServiceExtension_1800', 0, async function (done) {
let subscriber;
let flag = false;
console.info("====>Acts_StopServiceExtension_1800 start");
commonEvent.createSubscriber(ACTS_StopServiceExtension).then(async (data) => {
console.info("====>Acts_StopServiceExtension_1800 Create Subscribe");
subscriber = data;
commonEvent.subscribe(subscriber, subscribeCallBack);
globalThis.abilityContext.startAbility(
{
bundleName: "com.acts.stopserviceextensiontest",
abilityName: "ServiceAbility",
action: "Acts_StopServiceExtension_1800"
}, (err) => {
console.info("====>Acts_StopServiceExtension_1800 startAbility err: " + JSON.stringify(err));
expect(err.code).assertEqual(0);
})
})
function subscribeCallBack(err, data) {
console.info("====>Acts_StopServiceExtension_1800 subscribeCallBack data: " + JSON.stringify(data));
if (data.event == "ACTS_StopEvent_First") {
expect(data.parameters.message).assertEqual(16000050);
commonEvent.unsubscribe(subscriber, unSubscribeCallback);
}
}
function unSubscribeCallback() {
globalThis.abilityContext.stopServiceExtensionAbility({
bundleName: "com.acts.stopserviceextensiontest",
abilityName: "ServiceAbility"
}, (err) => {
console.info("====>Acts_StopServiceExtension_1800 stop ServiceAbility err: " + JSON.stringify(err));
expect(err.code).assertEqual(0);
console.info("====>Acts_StopServiceExtension_1800 unSubscribeCallback");
done();
})
}
setTimeout(() => {
if (flag == false) {
expect().assertFail();
commonEvent.unsubscribe(subscriber, unSubscribeCallback);
}
}, CASE_TIME_OUT)
})
})
}
\ No newline at end of file
/* /*
* Copyright (C) 2022 Huawei Device Co., Ltd. * Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
export default { import abilityTest from './Ability.test'
onCreate() {
console.info('Application onCreate') export default function testsuite() {
}, abilityTest()
onDestroy() {
console.info('Application onDestroy')
},
} }
\ No newline at end of file
/*
* Copyright (c) 2023 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 hilog from '@ohos.hilog';
import Ability from '@ohos.app.ability.UIAbility'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
import Window from '@ohos.window'
export default class TestAbility extends Ability {
onCreate(want, launchParam) {
this.context.stopServiceExtensionAbility
globalThis.abilityContext = this.context;
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate');
hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? '');
hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? '');
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!');
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}
onDestroy() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy');
}
onWindowStageCreate(windowStage: Window.WindowStage) {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate');
windowStage.loadContent('testability/pages/Index', (err, data) => {
if (err.code) {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.ERROR);
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
return;
}
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s',
JSON.stringify(data) ?? '');
});
}
onWindowStageDestroy() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy');
}
onForeground() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground');
}
onBackground() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground');
}
}
\ No newline at end of file
/* /*
* Copyright (C) 2022 Huawei Device Co., Ltd. * Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import {Core} from '@ohos/hypium' import hilog from '@ohos.hilog';
@Entry @Entry
@Component @Component
struct Index { struct Index {
aboutToAppear() { aboutToAppear() {
console.info('onShow finish') hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
const core = Core.getInstance() hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear');
core.init() }
const configService = core.getDefaultService('config') @State message: string = 'Hello World'
configService.setConfig(this) build() {
core.execute() Row() {
} Column() {
Text(this.message)
build() { .fontSize(50)
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { .fontWeight(FontWeight.Bold)
Text('Hello World') Button() {
.fontSize(50) Text('next page')
.fontWeight(FontWeight.Bold) .fontSize(20)
} .fontWeight(FontWeight.Bold)
.width('100%') }.type(ButtonType.Capsule)
.height('100%') .margin({
} top: 20
} })
\ No newline at end of file .backgroundColor('#0D9FFB')
.width('35%')
.height('5%')
.onClick(()=>{
})
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
{
"module": {
"name": "entry_test",
"type": "feature",
"description": "$string:module_test_desc",
"mainElement": "TestAbility",
"deviceTypes": [
"default",
"tablet"
],
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:test_pages",
"abilities": [
{
"name": "TestAbility",
"srcEntrance": "./ets/testability/TestAbility.ets",
"description": "$string:TestAbility_desc",
"icon": "$media:icon",
"label": "$string:TestAbility_label",
"visible": true,
"startWindowIcon": "$media:icon",
"startWindowBackground": "$color:start_window_background",
"skills": [
{
"actions": [
"action.system.home"
],
"entities": [
"entity.system.home"
]
}
]
}
],
"requestPermissions": [
{
"name": "ohos.permission.START_ABILITIES_FROM_BACKGROUND"
}
]
}
}
{
"color": [
{
"name": "start_window_background",
"value": "#FFFFFF"
}
]
}
\ No newline at end of file
{
"string": [
{
"name": "module_test_desc",
"value": "test ability description"
},
{
"name": "TestAbility_desc",
"value": "the test ability"
},
{
"name": "TestAbility_label",
"value": "test label"
}
]
}
\ No newline at end of file
# Copyright (c) 2023 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")
group("stopserviceextension") {
testonly = true
if (is_standard_system) {
deps = [
"ActsStopServiceExtensionRely:ActsStopServiceExtensionRely",
"ActsStopServiceExtensionTest:ActsStopServiceExtensionTest",
]
}
}
...@@ -47,7 +47,7 @@ export default function ActsAccountAppAccess() { ...@@ -47,7 +47,7 @@ export default function ActsAccountAppAccess() {
console.debug("====>afterEach start===="); console.debug("====>afterEach start====");
var appAccountManager = account.getAccountManager(); var appAccountManager = account.getAccountManager();
var accounts = await appAccountManager.getAllAccountByOwner(owner) var accounts = await appAccountManager.getAllAccountByOwner(owner)
for (i=0;i<accounts.length;i++){ for (var i=0;i<accounts.length;i++){
var localName = accounts[i].name var localName = accounts[i].name
if(localName == 'zhangsan'){ if(localName == 'zhangsan'){
await appAccountManager.removeAccount(localName) await appAccountManager.removeAccount(localName)
...@@ -70,7 +70,8 @@ export default function ActsAccountAppAccess() { ...@@ -70,7 +70,8 @@ export default function ActsAccountAppAccess() {
appAccountManager.checkAccountLabels(name, owner, ['level4'], (err, data)=>{ appAccountManager.checkAccountLabels(name, owner, ['level4'], (err, data)=>{
console.debug("====>ActsAccountCheckAccountLabels_0100 err:" + JSON.stringify(err)); console.debug("====>ActsAccountCheckAccountLabels_0100 err:" + JSON.stringify(err));
expect(err).assertEqual(null); expect(err).assertEqual(null);
console.debug("====>ActsAccountCheckAccountLabels_0100 data:" + JSON.stringify(data)); console.debug("====>ActsAccountCheckAccountLabels_0100 data:" + JSON.stringify(data));
expect(data).assertEqual(true);
appAccountManager.removeAccount(name, (err) =>{ appAccountManager.removeAccount(name, (err) =>{
console.debug("====>ActsAccountCheckAccountLabels_0100 removeAccount_err:" + JSON.stringify(err)) console.debug("====>ActsAccountCheckAccountLabels_0100 removeAccount_err:" + JSON.stringify(err))
expect(err).assertEqual(null); expect(err).assertEqual(null);
...@@ -98,7 +99,8 @@ export default function ActsAccountAppAccess() { ...@@ -98,7 +99,8 @@ export default function ActsAccountAppAccess() {
appAccountManager.checkAccountLabels(name, owner, ['20-30'], (err, data)=>{ appAccountManager.checkAccountLabels(name, owner, ['20-30'], (err, data)=>{
console.debug("====>ActsAccountCheckAccountLabels_0200 err:" + JSON.stringify(err)); console.debug("====>ActsAccountCheckAccountLabels_0200 err:" + JSON.stringify(err));
expect(err).assertEqual(null); expect(err).assertEqual(null);
console.debug("====>ActsAccountCheckAccountLabels_0200 data:" + JSON.stringify(data)); console.debug("====>ActsAccountCheckAccountLabels_0200 data:" + JSON.stringify(data));
expect(data).assertEqual(false);
appAccountManager.removeAccount(name, (err) =>{ appAccountManager.removeAccount(name, (err) =>{
console.debug("====>ActsAccountCheckAccountLabels_0200 removeAccount_err:" + JSON.stringify(err)) console.debug("====>ActsAccountCheckAccountLabels_0200 removeAccount_err:" + JSON.stringify(err))
expect(err).assertEqual(null); expect(err).assertEqual(null);
...@@ -125,8 +127,8 @@ export default function ActsAccountAppAccess() { ...@@ -125,8 +127,8 @@ export default function ActsAccountAppAccess() {
appAccountManager.checkAccountLabels('CheckAccountLabels_0300', owner, ['male'], (err, data)=>{ appAccountManager.checkAccountLabels('CheckAccountLabels_0300', owner, ['male'], (err, data)=>{
console.debug("====>ActsAccountCheckAccountLabels_0300 err:" + JSON.stringify(err)); console.debug("====>ActsAccountCheckAccountLabels_0300 err:" + JSON.stringify(err));
expect(err).assertEqual(null); expect(err).assertEqual(null);
console.debug("====>ActsAccountCheckAccountLabels_0300 data:" + JSON.stringify(data)); console.debug("====>ActsAccountCheckAccountLabels_0300 data:" + JSON.stringify(data));
expect(data).assertEqual(false) expect(data).assertEqual(false);
appAccountManager.removeAccount("CheckAccountLabels_0300", (err) =>{ appAccountManager.removeAccount("CheckAccountLabels_0300", (err) =>{
console.debug("====>ActsAccountCheckAccountLabels_0300 removeAccount_err:" + JSON.stringify(err)) console.debug("====>ActsAccountCheckAccountLabels_0300 removeAccount_err:" + JSON.stringify(err))
expect(err).assertEqual(null); expect(err).assertEqual(null);
...@@ -152,6 +154,7 @@ export default function ActsAccountAppAccess() { ...@@ -152,6 +154,7 @@ export default function ActsAccountAppAccess() {
console.debug("====>ActsAccountCheckAccountLabels_0400 add_account_success"); console.debug("====>ActsAccountCheckAccountLabels_0400 add_account_success");
appAccountManager.checkAccountLabels(name, owner, ['level4']).then((data) =>{ appAccountManager.checkAccountLabels(name, owner, ['level4']).then((data) =>{
console.debug("====>ActsAccountCheckAccountLabels_0400 data:" + JSON.stringify(data)); console.debug("====>ActsAccountCheckAccountLabels_0400 data:" + JSON.stringify(data));
expect(data).assertEqual(true);
appAccountManager.removeAccount(name).then((data) =>{ appAccountManager.removeAccount(name).then((data) =>{
console.debug("====>ActsAccountCheckAccountLabels_0400 delete_account_success"); console.debug("====>ActsAccountCheckAccountLabels_0400 delete_account_success");
done(); done();
...@@ -185,6 +188,7 @@ export default function ActsAccountAppAccess() { ...@@ -185,6 +188,7 @@ export default function ActsAccountAppAccess() {
console.debug("====>ActsAccountCheckAccountLabels_0500 add_account_success"); console.debug("====>ActsAccountCheckAccountLabels_0500 add_account_success");
appAccountManager.checkAccountLabels(name, owner, ['20-30']).then((data) =>{ appAccountManager.checkAccountLabels(name, owner, ['20-30']).then((data) =>{
console.debug("====>ActsAccountCheckAccountLabels_0500 data:" + JSON.stringify(data)); console.debug("====>ActsAccountCheckAccountLabels_0500 data:" + JSON.stringify(data));
expect(data).assertEqual(false);
expect(account.Constants.KEY_REQUIRED_LABELS).assertEqual('requiredLabels') expect(account.Constants.KEY_REQUIRED_LABELS).assertEqual('requiredLabels')
expect(account.Constants.KEY_BOOLEAN_RESULT).assertEqual('booleanResult') expect(account.Constants.KEY_BOOLEAN_RESULT).assertEqual('booleanResult')
appAccountManager.removeAccount(name).then((data) =>{ appAccountManager.removeAccount(name).then((data) =>{
...@@ -220,6 +224,7 @@ export default function ActsAccountAppAccess() { ...@@ -220,6 +224,7 @@ export default function ActsAccountAppAccess() {
console.debug("====>ActsAccountCheckAccountLabels_0600 add_account_success:" + JSON.stringify(data)); console.debug("====>ActsAccountCheckAccountLabels_0600 add_account_success:" + JSON.stringify(data));
appAccountManager.checkAccountLabels('CheckAccountLabels_0600', owner, ['male']).then((data) =>{ appAccountManager.checkAccountLabels('CheckAccountLabels_0600', owner, ['male']).then((data) =>{
console.debug("====>ActsAccountCheckAccountLabels_0600 data:" + JSON.stringify(data)); console.debug("====>ActsAccountCheckAccountLabels_0600 data:" + JSON.stringify(data));
expect(data).assertEqual(false);
appAccountManager.removeAccount('CheckAccountLabels_0600').then((data) =>{ appAccountManager.removeAccount('CheckAccountLabels_0600').then((data) =>{
console.debug("====>ActsAccountCheckAccountLabels_0600 delete_account_success"); console.debug("====>ActsAccountCheckAccountLabels_0600 delete_account_success");
done(); done();
......
...@@ -46,7 +46,7 @@ export default function ActsAccountAuthenticator() { ...@@ -46,7 +46,7 @@ export default function ActsAccountAuthenticator() {
console.debug("====>afterEach start===="); console.debug("====>afterEach start====");
var appAccountManager = account.getAccountManager(); var appAccountManager = account.getAccountManager();
var accounts = await appAccountManager.getAllAccountByOwner(owner) var accounts = await appAccountManager.getAllAccountByOwner(owner)
for (i=0;i<accounts.length;i++){ for (var i=0;i<accounts.length;i++){
var localName = accounts[i].name var localName = accounts[i].name
if(localName == 'zhangsan'){ if(localName == 'zhangsan'){
await appAccountManager.removeAccount(localName) await appAccountManager.removeAccount(localName)
...@@ -69,7 +69,8 @@ export default function ActsAccountAuthenticator() { ...@@ -69,7 +69,8 @@ export default function ActsAccountAuthenticator() {
appAccountManager.checkAccountLabels(name, owner, ['level4'], (err, data)=>{ appAccountManager.checkAccountLabels(name, owner, ['level4'], (err, data)=>{
console.debug("====>ActsAccountCheckAccountLabels_0100 err:" + JSON.stringify(err)); console.debug("====>ActsAccountCheckAccountLabels_0100 err:" + JSON.stringify(err));
expect(err).assertEqual(null); expect(err).assertEqual(null);
console.debug("====>ActsAccountCheckAccountLabels_0100 data:" + JSON.stringify(data)); console.debug("====>ActsAccountCheckAccountLabels_0100 data:" + JSON.stringify(data));
expect(data).assertEqual(true);
appAccountManager.deleteAccount(name, (err) =>{ appAccountManager.deleteAccount(name, (err) =>{
console.debug("====>ActsAccountCheckAccountLabels_0100 deleteAccount_err:" + JSON.stringify(err)) console.debug("====>ActsAccountCheckAccountLabels_0100 deleteAccount_err:" + JSON.stringify(err))
expect(err).assertEqual(null); expect(err).assertEqual(null);
...@@ -97,7 +98,8 @@ export default function ActsAccountAuthenticator() { ...@@ -97,7 +98,8 @@ export default function ActsAccountAuthenticator() {
appAccountManager.checkAccountLabels(name, owner, ['20-30'], (err, data)=>{ appAccountManager.checkAccountLabels(name, owner, ['20-30'], (err, data)=>{
console.debug("====>ActsAccountCheckAccountLabels_0200 err:" + JSON.stringify(err)); console.debug("====>ActsAccountCheckAccountLabels_0200 err:" + JSON.stringify(err));
expect(err).assertEqual(null); expect(err).assertEqual(null);
console.debug("====>ActsAccountCheckAccountLabels_0200 data:" + JSON.stringify(data)); console.debug("====>ActsAccountCheckAccountLabels_0200 data:" + JSON.stringify(data));
expect(data).assertEqual(false);
appAccountManager.deleteAccount(name, (err) =>{ appAccountManager.deleteAccount(name, (err) =>{
console.debug("====>ActsAccountCheckAccountLabels_0200 deleteAccount_err:" + JSON.stringify(err)) console.debug("====>ActsAccountCheckAccountLabels_0200 deleteAccount_err:" + JSON.stringify(err))
expect(err).assertEqual(null); expect(err).assertEqual(null);
...@@ -124,8 +126,8 @@ export default function ActsAccountAuthenticator() { ...@@ -124,8 +126,8 @@ export default function ActsAccountAuthenticator() {
appAccountManager.checkAccountLabels('CheckAccountLabels_0300', owner, ['male'], (err, data)=>{ appAccountManager.checkAccountLabels('CheckAccountLabels_0300', owner, ['male'], (err, data)=>{
console.debug("====>ActsAccountCheckAccountLabels_0300 err:" + JSON.stringify(err)); console.debug("====>ActsAccountCheckAccountLabels_0300 err:" + JSON.stringify(err));
expect(err).assertEqual(null); expect(err).assertEqual(null);
console.debug("====>ActsAccountCheckAccountLabels_0300 data:" + JSON.stringify(data)); console.debug("====>ActsAccountCheckAccountLabels_0300 data:" + JSON.stringify(data));
expect(data).assertEqual(false) expect(data).assertEqual(false);
appAccountManager.deleteAccount("CheckAccountLabels_0300", (err) =>{ appAccountManager.deleteAccount("CheckAccountLabels_0300", (err) =>{
console.debug("====>ActsAccountCheckAccountLabels_0300 deleteAccount_err:" + JSON.stringify(err)) console.debug("====>ActsAccountCheckAccountLabels_0300 deleteAccount_err:" + JSON.stringify(err))
expect(err).assertEqual(null); expect(err).assertEqual(null);
...@@ -151,6 +153,7 @@ export default function ActsAccountAuthenticator() { ...@@ -151,6 +153,7 @@ export default function ActsAccountAuthenticator() {
console.debug("====>ActsAccountCheckAccountLabels_0400 add_account_success"); console.debug("====>ActsAccountCheckAccountLabels_0400 add_account_success");
appAccountManager.checkAccountLabels(name, owner, ['level4']).then((data) =>{ appAccountManager.checkAccountLabels(name, owner, ['level4']).then((data) =>{
console.debug("====>ActsAccountCheckAccountLabels_0400 data:" + JSON.stringify(data)); console.debug("====>ActsAccountCheckAccountLabels_0400 data:" + JSON.stringify(data));
expect(data).assertEqual(true);
appAccountManager.deleteAccount(name).then((data) =>{ appAccountManager.deleteAccount(name).then((data) =>{
console.debug("====>ActsAccountCheckAccountLabels_0400 delete_account_success"); console.debug("====>ActsAccountCheckAccountLabels_0400 delete_account_success");
}).catch((err) =>{ }).catch((err) =>{
...@@ -164,7 +167,7 @@ export default function ActsAccountAuthenticator() { ...@@ -164,7 +167,7 @@ export default function ActsAccountAuthenticator() {
}) })
}).catch((err) => { }).catch((err) => {
console.debug("====>ActsAccountCheckAccountLabels_0400 add_account_err:" + JSON.stringify(err)) console.debug("====>ActsAccountCheckAccountLabels_0400 add_account_err:" + JSON.stringify(err))
expect(err.code!=0).assertTrue(); expect().assertFail();
done(); done();
}) })
}); });
...@@ -182,6 +185,7 @@ export default function ActsAccountAuthenticator() { ...@@ -182,6 +185,7 @@ export default function ActsAccountAuthenticator() {
console.debug("====>ActsAccountCheckAccountLabels_0500 add_account_success"); console.debug("====>ActsAccountCheckAccountLabels_0500 add_account_success");
appAccountManager.checkAccountLabels(name, owner, ['20-30']).then((data) =>{ appAccountManager.checkAccountLabels(name, owner, ['20-30']).then((data) =>{
console.debug("====>ActsAccountCheckAccountLabels_0500 data:" + JSON.stringify(data)); console.debug("====>ActsAccountCheckAccountLabels_0500 data:" + JSON.stringify(data));
expect(data).assertEqual(false);
expect(account.Constants.KEY_REQUIRED_LABELS).assertEqual('requiredLabels') expect(account.Constants.KEY_REQUIRED_LABELS).assertEqual('requiredLabels')
expect(account.Constants.KEY_BOOLEAN_RESULT).assertEqual('booleanResult') expect(account.Constants.KEY_BOOLEAN_RESULT).assertEqual('booleanResult')
appAccountManager.deleteAccount(name).then((data) =>{ appAccountManager.deleteAccount(name).then((data) =>{
...@@ -215,6 +219,7 @@ export default function ActsAccountAuthenticator() { ...@@ -215,6 +219,7 @@ export default function ActsAccountAuthenticator() {
console.debug("====>ActsAccountCheckAccountLabels_0600 add_account_success:" + JSON.stringify(data)); console.debug("====>ActsAccountCheckAccountLabels_0600 add_account_success:" + JSON.stringify(data));
appAccountManager.checkAccountLabels('CheckAccountLabels_0600', owner, ['male']).then((data) =>{ appAccountManager.checkAccountLabels('CheckAccountLabels_0600', owner, ['male']).then((data) =>{
console.debug("====>ActsAccountCheckAccountLabels_0600 data:" + JSON.stringify(data)); console.debug("====>ActsAccountCheckAccountLabels_0600 data:" + JSON.stringify(data));
expect(data).assertEqual(false);
appAccountManager.deleteAccount('CheckAccountLabels_0600').then((data) =>{ appAccountManager.deleteAccount('CheckAccountLabels_0600').then((data) =>{
console.debug("====>ActsAccountCheckAccountLabels_0600 delete_account_success"); console.debug("====>ActsAccountCheckAccountLabels_0600 delete_account_success");
}).catch((err) =>{ }).catch((err) =>{
......
...@@ -22,6 +22,25 @@ const SELFBUNDLE = 'com.example.actsgetaccountsbyowner' ...@@ -22,6 +22,25 @@ const SELFBUNDLE = 'com.example.actsgetaccountsbyowner'
const createAccountOptions = {customData:{age:'12'}} const createAccountOptions = {customData:{age:'12'}}
export default function GetAccountsByOwner() { export default function GetAccountsByOwner() {
describe('GetAccountsByOwner', function () { describe('GetAccountsByOwner', function () {
beforeAll(async function (done) {
console.debug("====>startAbility start====");
await featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.example.actsscenegetallaccounts",
abilityName: "com.example.actsscenegetallaccounts.MainAbility",
action: "action1",
parameters:
{},
},
},
);
await sleep(TIMEOUT);
done();
});
async function sleep(delay) { async function sleep(delay) {
let timeoutId = null; let timeoutId = null;
var promise = new Promise((resolve, reject) => { var promise = new Promise((resolve, reject) => {
...@@ -266,20 +285,6 @@ export default function GetAccountsByOwner() { ...@@ -266,20 +285,6 @@ export default function GetAccountsByOwner() {
console.debug("====>creat finish===="); console.debug("====>creat finish====");
console.debug("====>add account 0900 start===="); console.debug("====>add account 0900 start====");
await appAccountManager.createAccount("Account_application_callback"); await appAccountManager.createAccount("Account_application_callback");
console.debug("====>startAbility 0900 start====");
await featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.example.actsscenegetallaccounts",
abilityName: "com.example.actsscenegetallaccounts.MainAbility",
action: "action1",
parameters:
{},
},
},
);
function getAllCallback(err, data){ function getAllCallback(err, data){
console.debug("====>getAccountsByOwner 0900 err:" + JSON.stringify(err)); console.debug("====>getAccountsByOwner 0900 err:" + JSON.stringify(err));
console.debug("====>getAccountsByOwner 0900 data:" + JSON.stringify(data)); console.debug("====>getAccountsByOwner 0900 data:" + JSON.stringify(data));
...@@ -310,21 +315,7 @@ export default function GetAccountsByOwner() { ...@@ -310,21 +315,7 @@ export default function GetAccountsByOwner() {
console.debug("====>creat finish===="); console.debug("====>creat finish====");
console.debug("====>add account 1000 start===="); console.debug("====>add account 1000 start====");
await appAccountManager.createAccount("Account_application_promise"); await appAccountManager.createAccount("Account_application_promise");
console.debug("====>startAbility 1000 start===="); await sleep(TIMEOUT)
await featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.example.actsscenegetallaccounts",
abilityName: "com.example.actsscenegetallaccounts.MainAbility",
action: "action1",
parameters:
{},
},
},
);
sleep(TIMEOUT)
console.debug("====>getAccountsByOwner 1000 start===="); console.debug("====>getAccountsByOwner 1000 start====");
try{ try{
var data = await appAccountManager.getAccountsByOwner(SELFBUNDLE); var data = await appAccountManager.getAccountsByOwner(SELFBUNDLE);
...@@ -361,20 +352,6 @@ export default function GetAccountsByOwner() { ...@@ -361,20 +352,6 @@ export default function GetAccountsByOwner() {
var appAccountManager = account.createAppAccountManager(); var appAccountManager = account.createAppAccountManager();
console.debug("====>creat finish===="); console.debug("====>creat finish====");
var specifiedBundle = "com.example.actsscenegetallaccounts"; var specifiedBundle = "com.example.actsscenegetallaccounts";
console.debug("====>startAbility 1100 start====");
await featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.example.actsscenegetallaccounts",
abilityName: "com.example.actsscenegetallaccounts.MainAbility",
action: "action1",
parameters:
{},
},
},
);
function getAllCallback(err, data){ function getAllCallback(err, data){
console.debug("====>getAccountsByOwner 1100 err:" + JSON.stringify(err)); console.debug("====>getAccountsByOwner 1100 err:" + JSON.stringify(err));
console.debug("====>getAccountsByOwner 1100 data:" + JSON.stringify(data)); console.debug("====>getAccountsByOwner 1100 data:" + JSON.stringify(data));
...@@ -384,7 +361,7 @@ export default function GetAccountsByOwner() { ...@@ -384,7 +361,7 @@ export default function GetAccountsByOwner() {
console.debug("====>GetAccountsByOwner_1100 end===="); console.debug("====>GetAccountsByOwner_1100 end====");
done(); done();
} }
sleep(TIMEOUT) await sleep(TIMEOUT)
console.debug("====>getAccountsByOwner 1100 start===="); console.debug("====>getAccountsByOwner 1100 start====");
appAccountManager.getAccountsByOwner(specifiedBundle, getAllCallback); appAccountManager.getAccountsByOwner(specifiedBundle, getAllCallback);
}); });
...@@ -400,20 +377,6 @@ export default function GetAccountsByOwner() { ...@@ -400,20 +377,6 @@ export default function GetAccountsByOwner() {
var appAccountManager = account.createAppAccountManager(); var appAccountManager = account.createAppAccountManager();
console.debug("====>creat finish===="); console.debug("====>creat finish====");
var specifiedBundle = "com.example.actsscenegetallaccounts"; var specifiedBundle = "com.example.actsscenegetallaccounts";
console.debug("====>startAbility 1200 start====");
await featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.example.actsscenegetallaccounts",
abilityName: "com.example.actsscenegetallaccounts.MainAbility",
action: "action1",
parameters:
{},
},
},
);
await sleep(TIMEOUT) await sleep(TIMEOUT)
console.debug("====>getAccountsByOwner 1200 start===="); console.debug("====>getAccountsByOwner 1200 start====");
try{ try{
......
...@@ -29,6 +29,7 @@ group("arkui") { ...@@ -29,6 +29,7 @@ group("arkui") {
"ace_ets_test:ActsAceEtsTest", "ace_ets_test:ActsAceEtsTest",
"ace_ets_third_test:ActsAceEtsThirdTest", "ace_ets_third_test:ActsAceEtsThirdTest",
"ace_ets_web_dev:ActsAceWebDevTest", "ace_ets_web_dev:ActsAceWebDevTest",
"ace_ets_web_dev_four:ActsAceWebDevFourTest",
"ace_ets_web_dev_three:ActsAceWebDevThreeTest", "ace_ets_web_dev_three:ActsAceWebDevThreeTest",
"ace_ets_web_dev_two:ActsAceWebDevTwoTest", "ace_ets_web_dev_two:ActsAceWebDevTwoTest",
"ace_ets_xcomponent:ActsAceXComponentEtsTest", "ace_ets_xcomponent:ActsAceXComponentEtsTest",
......
...@@ -397,7 +397,7 @@ export default function textStyleJsunit() { ...@@ -397,7 +397,7 @@ export default function textStyleJsunit() {
console.info("[testTextStyle016] component strJson:" + strJson); console.info("[testTextStyle016] component strJson:" + strJson);
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info("[testTextStyle016] fontWeight: " + obj.$attrs.fontWeight); console.info("[testTextStyle016] fontWeight: " + obj.$attrs.fontWeight);
expect(obj.$attrs.fontWeight).assertEqual('FontWeight.700'); expect(obj.$attrs.fontWeight).assertEqual('700');
done(); done();
}); });
...@@ -423,7 +423,7 @@ export default function textStyleJsunit() { ...@@ -423,7 +423,7 @@ export default function textStyleJsunit() {
console.info("[testTextStyle017] component strJson:" + strJson); console.info("[testTextStyle017] component strJson:" + strJson);
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info("[testTextStyle017] fontWeight: " + obj.$attrs.fontWeight); console.info("[testTextStyle017] fontWeight: " + obj.$attrs.fontWeight);
expect(obj.$attrs.fontWeight).assertEqual('FontWeight.400'); expect(obj.$attrs.fontWeight).assertEqual('400');
done(); done();
}); });
......
...@@ -70,7 +70,7 @@ struct NavRouterPage { ...@@ -70,7 +70,7 @@ struct NavRouterPage {
Flex({ direction: FlexDirection.Row }) { Flex({ direction: FlexDirection.Row }) {
Row() { Row() {
Image($r('app.media.icon')).width(40).height(40).borderRadius(40).margin({ right: 15 }) Image($r('app.media.icon')).width(40).height(40).borderRadius(40).margin({ right: 15 })
Text('Hello').fontSize(30).key('textContent' + (item + 1).toString()) Text('Hello').fontSize(30).key('textContent')
}.padding({ left: 15 }) }.padding({ left: 15 })
} }
}.backgroundColor('#ccc') }.backgroundColor('#ccc')
...@@ -91,7 +91,7 @@ struct NavRouterPage { ...@@ -91,7 +91,7 @@ struct NavRouterPage {
.hideTitleBar(true) .hideTitleBar(true)
.hideToolBar(true) .hideToolBar(true)
.height('80%') .height('80%')
Text(this.stateChange).fontSize(20).margin(10).id('123') Text(this.stateChange).fontSize(20).margin(10).key('testT')
}.height('100%') }.height('100%')
} }
} }
......
...@@ -26,7 +26,7 @@ struct TextInputPage { ...@@ -26,7 +26,7 @@ struct TextInputPage {
@State maxLength: number = 10 @State maxLength: number = 10
@State copyOption: CopyOptions = CopyOptions.None @State copyOption: CopyOptions = CopyOptions.None
@State showPasswordIcon: boolean = false @State showPasswordIcon: boolean = false
@State style: TextInputStyle = TextInputStyle.Inline @State style: TextInputStyle = TextInputStyle.Default
@State textAlign: TextAlign = TextAlign.Center @State textAlign: TextAlign = TextAlign.Center
@State text: string = 'onChange' @State text: string = 'onChange'
@State onSubmit: string = '' @State onSubmit: string = ''
...@@ -163,7 +163,7 @@ struct TextInputPage { ...@@ -163,7 +163,7 @@ struct TextInputPage {
.style(TextInputStyle.Inline) .style(TextInputStyle.Inline)
Text('onSubmit:' + this.onSubmit).fontSize(20).margin(10).key('submit') Text('onSubmit:' + this.onSubmit).fontSize(20).margin(10).key('submit')
Text('onEditChange:' + this.onEditChange).fontSize(20).margin(10).key('editChange') Text('onEditChange:' + this.onEditChange).fontSize(20).margin(10).key('editChange')
Text('onCopy:' + this.onCopy).fontSize(20).margin(10).id('copy') Text('onCopy:' + this.onCopy).fontSize(20).margin(10).key('copy')
Text('onCut:' + this.onCut).fontSize(20).margin(10).key('cut') Text('onCut:' + this.onCut).fontSize(20).margin(10).key('cut')
Text('onPaste:' + this.onPaste).fontSize(20).margin(10).key('paste') Text('onPaste:' + this.onPaste).fontSize(20).margin(10).key('paste')
}.width('100%') }.width('100%')
......
...@@ -50,7 +50,7 @@ struct CheckboxExample { ...@@ -50,7 +50,7 @@ struct CheckboxExample {
} else { } else {
this.selectedColor = "#000000" this.selectedColor = "#000000"
} }
}).key("check1").id('chek1') }).id('chek1')
Checkbox({name: 'checkbox2', group: 'checkboxGroup'}) Checkbox({name: 'checkbox2', group: 'checkboxGroup'})
.select(false) .select(false)
.selectedColor(0x39a2db) .selectedColor(0x39a2db)
......
...@@ -44,7 +44,7 @@ struct ImageAnimatorExample { ...@@ -44,7 +44,7 @@ struct ImageAnimatorExample {
} }
let callback:Callback = (message:any) => { let callback:Callback = (message:any) => {
console.error('message = ' + message.name + "--" + message.value) console.error('message = ' + message.name + "--" + message.value)
if (message.name == 'type') { if (message.name == 'state') {
this.state = message.value this.state = message.value
} }
if (message.name == 'reverse') { if (message.name == 'reverse') {
...@@ -56,24 +56,12 @@ struct ImageAnimatorExample { ...@@ -56,24 +56,12 @@ struct ImageAnimatorExample {
if (message.name == 'fixedSize') { if (message.name == 'fixedSize') {
this.fixedSize = message.value this.fixedSize = message.value
} }
if (message.fillMode == 'fillMode') { if (message.name == 'fillMode') {
this.fillMode = message.value this.fillMode = message.value
} }
if (message.duration == 'duration') { if (message.name == 'duration') {
this.duration = message.value this.duration = message.value
} }
if (message.widthT == 'widthT') {
this.widthT = message.value
}
if (message.heightT == 'heighT') {
this.heightT = message.value
}
if (message.top == 'top') {
this.top = message.value
}
if (message.left == 'left') {
this.left = message.value
}
} }
this.messageManager.registerCallback(callback) this.messageManager.registerCallback(callback)
} }
...@@ -111,7 +99,7 @@ struct ImageAnimatorExample { ...@@ -111,7 +99,7 @@ struct ImageAnimatorExample {
.margin({ top: 100 }) .margin({ top: 100 })
.key('imageAnimator') .key('imageAnimator')
.onStart(() => { .onStart(() => {
console.info('Start') console.info('Start123456')
this.message1 = 'start' this.message1 = 'start'
}) })
.onPause(() => { .onPause(() => {
......
...@@ -24,9 +24,11 @@ struct ImageExample3 { ...@@ -24,9 +24,11 @@ struct ImageExample3 {
private on2off: Resource = $rawfile('bm.jpg') private on2off: Resource = $rawfile('bm.jpg')
private off2on: Resource = $rawfile('test3.png') private off2on: Resource = $rawfile('test3.png')
@State src: Resource = this.on @State src: Resource = this.on
@State m1:string = "xx" @State m1:string = "init"
@State m2:string = "x" @State m2:string = "init"
@State name:string = "tt3.png" @State m3:string = "init"
@State m4:string = "init"
@State imageName:string = "img1.png"
messageManager:MessageManager = new MessageManager() messageManager:MessageManager = new MessageManager()
...@@ -37,8 +39,8 @@ struct ImageExample3 { ...@@ -37,8 +39,8 @@ struct ImageExample3 {
} }
let callback:Callback = (message:any) => { let callback:Callback = (message:any) => {
console.error('message = ' + message.name + "--" + message.value) console.error('message = ' + message.name + "--" + message.value)
if (message.name == 'name') { if (message.name == 'imageName') {
this.name = message.value this.imageName = message.value
} }
} }
this.messageManager.registerCallback(callback) this.messageManager.registerCallback(callback)
...@@ -49,9 +51,9 @@ struct ImageExample3 { ...@@ -49,9 +51,9 @@ struct ImageExample3 {
Column() { Column() {
Row({ space: 20 }) { Row({ space: 20 }) {
Column() { Column() {
Image($rawfile(this.name)) Image($rawfile(this.imageName))
.alt($rawfile('img2.png')) .alt($rawfile('img2.png'))
.key('image2') .key('image1')
.sourceSize({ .sourceSize({
width: 900, width: 900,
height: 900 height: 900
...@@ -66,37 +68,40 @@ struct ImageExample3 { ...@@ -66,37 +68,40 @@ struct ImageExample3 {
}) })
.onError(() => { .onError(() => {
console.log('load image fail') console.log('load image fail')
this.m1 = "error" this.m2 = "error"
}) })
.overlay('\nwidth: ' + String(this.widthValue) + ' height: ' + String(this.heightValue), { .overlay('\nwidth: ' + String(this.widthValue) + ' height: ' + String(this.heightValue), {
align: Alignment.Bottom, align: Alignment.Bottom,
offset: { x: 0, y: 20 } offset: { x: 0, y: 20 }
}) })
Text(this.m1).margin({top:40}).key('text1') Text(this.m1).margin({top:40}).key('complete')
Text(this.m2).margin({top:40}).key('text2') Text(this.m2).margin({top:40}).key('error')
} Text(this.m3).margin({top:40}).key('click')
Text(this.m4).margin({top:40}).key('Finish')
// 为图片添加点击事件,点击完成后加载特定图片。 // 为图片添加点击事件,点击完成后加载特定图片。
Image(this.src) Image(this.src)
.width(120).height(120) .width(120).height(120)
.onClick(() => { .onClick(() => {
if (this.src == this.on || this.src == this.off2on) { if (this.src == this.on || this.src == this.off2on) {
this.src = this.on2off this.src = this.on2off
this.m1 = "click" this.m3 = "click"
} else { } else {
this.src = this.off2on this.src = this.off2on
this.m1 = "click" this.m3 = "click"
} }
}).key('igc') }).key('image2')
.onFinish(() => { .onFinish(() => {
if (this.src == this.off2on) { if (this.src == this.off2on) {
this.src = this.on this.src = this.on
this.m2 = "Finish" this.m4 = "Finish"
} else { } else {
this.src = this.off this.src = this.off
this.m2 = "Finish" this.m4 = "Finish"
} }
}) })
}
} }
}.width('100%') }.width('100%')
} }
......
...@@ -48,8 +48,8 @@ struct SliderExample { ...@@ -48,8 +48,8 @@ struct SliderExample {
} }
let callback:Callback = (message:any) => { let callback:Callback = (message:any) => {
console.error('message = ' + message.name + "--" + message.value) console.error('message = ' + message.name + "--" + message.value)
if (message.name == 'outSetValueOne') { if (message.name == 'vInSetValueOne') {
this.outSetValueOne = message.value this.vInSetValueOne = message.value
} }
if (message.name == 'style') { if (message.name == 'style') {
this.style = message.value this.style = message.value
......
...@@ -106,9 +106,6 @@ struct TextAreaExample { ...@@ -106,9 +106,6 @@ struct TextAreaExample {
.textAlign(this.textAlign) .textAlign(this.textAlign)
.caretColor(this.caretColor) .caretColor(this.caretColor)
.backgroundColor('#FFFFFF') .backgroundColor('#FFFFFF')
.inputFilter("shang",err => {
console.info("te")
})
.copyOption(this.copyOption) .copyOption(this.copyOption)
.onChange((value: string) => { .onChange((value: string) => {
this.message1 = value this.message1 = value
......
...@@ -67,13 +67,13 @@ export default function blankJsunit() { ...@@ -67,13 +67,13 @@ export default function blankJsunit() {
console.info('blankJsunitUITest_0200 START'); console.info('blankJsunitUITest_0200 START');
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
// 动态修改Blank组件的minwidth // 动态修改Blank组件的minwidth
globalThis.value.message.notify({name:'minWith',value:80}) globalThis.value.message.notify({name:'minWith',value:'80'})
await CommonFunc.sleep(2000); await CommonFunc.sleep(3000);
// 获取动态修改后的组件的minwidth // 获取动态修改后的组件的minwidth
let strJson = getInspectorByKey('bl2'); let strJson = getInspectorByKey('bl2');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info("[blankJsunit_0200'] component obj is: " + JSON.stringify(obj)); console.info("[blankJsunit_0200'] component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.min).assertEqual('80.00px'); expect(obj.$attrs.min).assertEqual('80.00vp');
done(); done();
}); });
......
...@@ -109,7 +109,7 @@ export default function checkBoxJsunit() { ...@@ -109,7 +109,7 @@ export default function checkBoxJsunit() {
let strJson = getInspectorByKey('chek1'); let strJson = getInspectorByKey('chek1');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info("[blankJsunit_0400'] component obj is: " + JSON.stringify(obj)); console.info("[blankJsunit_0400'] component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.selectedColor).assertEqual('#FF000000'); expect(obj.$attrs.selectedColor).assertEqual('#FFFFFF21');
done(); done();
}); });
......
...@@ -166,14 +166,12 @@ export default function GridItemJsunit() { ...@@ -166,14 +166,12 @@ export default function GridItemJsunit() {
it('GridJsunit_0500', 0, async function (done) { it('GridJsunit_0500', 0, async function (done) {
// Verify the columnsTemplate of Grid component // Verify the columnsTemplate of Grid component
console.info('[GridJsunit_0500] START'); console.info('[GridJsunit_0500] START');
let gridItem1 = CommonFunc.getComponentRect('gridItem1'); let gridItem1 = CommonFunc.getComponentRect('0');
let left1 = gridItem1.left let right1 = gridItem1.right;
let gridItem2 = CommonFunc.getComponentRect('gridItem1');
let right1 = gridItem2.right
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
let gridItem3 = CommonFunc.getComponentRect('3'); let gridItem3 = CommonFunc.getComponentRect('1');
let right2 = gridItem3.right let left3 = gridItem3.left;
expect(right2 - left1 - 4 * 6).assertEqual((right1 - left1) * 5); expect(left3 - right1).assertEqual(vp2px(4));
console.info('[GridJsunit_0500] END'); console.info('[GridJsunit_0500] END');
done(); done();
}); });
...@@ -183,12 +181,10 @@ export default function GridItemJsunit() { ...@@ -183,12 +181,10 @@ export default function GridItemJsunit() {
console.info('[GridJsunit_0600] START'); console.info('[GridJsunit_0600] START');
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
let gridItem1 = CommonFunc.getComponentRect('0'); let gridItem1 = CommonFunc.getComponentRect('0');
let top1 = gridItem1.top let bottom1 = gridItem1.bottom;
let gridItem2 = CommonFunc.getComponentRect('gridItem3'); let gridItem3 = CommonFunc.getComponentRect('4');
let top2 = gridItem2.top let top3 = gridItem3.top;
let gridItem3 = CommonFunc.getComponentRect('gridItem3'); expect(top3 - bottom1).assertEqual(vp2px(5));
let bottom2 = gridItem3.bottom
expect((bottom2 - top2) * 4 + 7.5).assertEqual(bottom2 - top1 - 5 * 3);
console.info('[GridJsunit_0600] END'); console.info('[GridJsunit_0600] END');
done(); done();
}); });
...@@ -199,10 +195,10 @@ export default function GridItemJsunit() { ...@@ -199,10 +195,10 @@ export default function GridItemJsunit() {
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
let driver = await UiDriver.create() let driver = await UiDriver.create()
let gridItem1 = CommonFunc.getComponentRect('gridItem1'); let gridItem1 = CommonFunc.getComponentRect('gridItem1');
let right1 = gridItem1.right let right1 = gridItem1.right;
let gridItem2 = CommonFunc.getComponentRect('0'); let gridItem2 = CommonFunc.getComponentRect('0');
let left1 = gridItem2.left let left1 = gridItem2.left;
expect(left1 - right1).assertEqual(6); expect(left1 - right1).assertEqual(vp2px(4));
console.info('[GridJsunit_0700] END'); console.info('[GridJsunit_0700] END');
done(); done();
}); });
...@@ -216,10 +212,10 @@ export default function GridItemJsunit() { ...@@ -216,10 +212,10 @@ export default function GridItemJsunit() {
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
let driver = await UiDriver.create() let driver = await UiDriver.create()
let gridItem1 = CommonFunc.getComponentRect('gridItem1'); let gridItem1 = CommonFunc.getComponentRect('gridItem1');
let bottom1 = gridItem1.bottom let bottom1 = gridItem1.bottom;
let gridItem2 = CommonFunc.getComponentRect('gridItem3'); let gridItem2 = CommonFunc.getComponentRect('gridItem3');
let top1 = gridItem2.top let top1 = gridItem2.top;
expect(top1 - bottom1).assertEqual(7.5); expect(top1 - bottom1).assertEqual(vp2px(5));
console.info('[GridJsunit_0800] END'); console.info('[GridJsunit_0800] END');
done(); done();
}); });
......
...@@ -187,7 +187,7 @@ export default function GridJsunit() { ...@@ -187,7 +187,7 @@ export default function GridJsunit() {
console.info("[GridJsunit_0500] supportAnimation: " + JSON.stringify(obj.$attrs.supportAnimation)); console.info("[GridJsunit_0500] supportAnimation: " + JSON.stringify(obj.$attrs.supportAnimation));
expect(obj.$attrs.columnsGap).assertEqual('0.00vp'); expect(obj.$attrs.columnsGap).assertEqual('0.00vp');
expect(obj.$attrs.rowsGap).assertEqual('0.00vp'); expect(obj.$attrs.rowsGap).assertEqual('0.00vp');
expect(obj.$attrs.scrollBar).assertEqual('BarState.Off'); expect(obj.$attrs.scrollBar).assertEqual('BarState.Auto');
expect(obj.$attrs.cachedCount).assertEqual(1); expect(obj.$attrs.cachedCount).assertEqual(1);
expect(obj.$attrs.supportAnimation).assertEqual('false'); expect(obj.$attrs.supportAnimation).assertEqual('false');
console.info('[GridJsunit_0500] END'); console.info('[GridJsunit_0500] END');
......
...@@ -57,7 +57,11 @@ export default function GridRowJsunit() { ...@@ -57,7 +57,11 @@ export default function GridRowJsunit() {
expect(obj.$attrs.columns).assertEqual('4'); expect(obj.$attrs.columns).assertEqual('4');
expect(obj.$attrs.breakpoints).assertEqual('4'); expect(obj.$attrs.breakpoints).assertEqual('4');
expect(obj.$attrs.direction).assertEqual('4'); expect(obj.$attrs.direction).assertEqual('4');
expect(obj.$attrs.gutter).assertEqual('<7.500000, 15.000000'); // fix the vp2px
let x = vp2px(5).toFixed(6);
let y = vp2px(10).toFixed(6);
let str = '<' + x + ', '+y;
expect(obj.$attrs.gutter).assertEqual(str);
console.info('[GridRowJsunit_0100] END'); console.info('[GridRowJsunit_0100] END');
done(); done();
}); });
...@@ -85,9 +89,12 @@ export default function GridRowJsunit() { ...@@ -85,9 +89,12 @@ export default function GridRowJsunit() {
console.info("[GridRowJsunit_0200] direction: " + JSON.stringify(obj.$attrs.direction)); console.info("[GridRowJsunit_0200] direction: " + JSON.stringify(obj.$attrs.direction));
console.info("[GridRowJsunit_0200] gutter: " + JSON.stringify(obj.$attrs.gutter)); console.info("[GridRowJsunit_0200] gutter: " + JSON.stringify(obj.$attrs.gutter));
expect(obj.$attrs.columns).assertEqual('12'); expect(obj.$attrs.columns).assertEqual('12');
expect(obj.$attrs.gutter).assertEqual('<7.500000, 15.000000');
expect(obj.$attrs.breakpoints).assertEqual('12'); expect(obj.$attrs.breakpoints).assertEqual('12');
expect(obj.$attrs.direction).assertEqual('12'); expect(obj.$attrs.direction).assertEqual('12');
let x = vp2px(5).toFixed(6);
let y = vp2px(10).toFixed(6);
let str = '<' + x + ', '+y;
expect(obj.$attrs.gutter).assertEqual(str);
console.info('[GridRowJsunit_0200] END'); console.info('[GridRowJsunit_0200] END');
done(); done();
}); });
...@@ -115,9 +122,12 @@ export default function GridRowJsunit() { ...@@ -115,9 +122,12 @@ export default function GridRowJsunit() {
console.info("[GridRowJsunit_0300] direction: " + JSON.stringify(obj.$attrs.direction)); console.info("[GridRowJsunit_0300] direction: " + JSON.stringify(obj.$attrs.direction));
console.info("[GridRowJsunit_0300] gutter: " + JSON.stringify(obj.$attrs.gutter)); console.info("[GridRowJsunit_0300] gutter: " + JSON.stringify(obj.$attrs.gutter));
expect(obj.$attrs.columns).assertEqual('12'); expect(obj.$attrs.columns).assertEqual('12');
expect(obj.$attrs.gutter).assertEqual('<7.500000, 15.000000');
expect(obj.$attrs.breakpoints).assertEqual('12'); expect(obj.$attrs.breakpoints).assertEqual('12');
expect(obj.$attrs.direction).assertEqual('12'); expect(obj.$attrs.direction).assertEqual('12');
let x = vp2px(5).toFixed(6);
let y = vp2px(10).toFixed(6);
let str = '<' + x + ', '+y;
expect(obj.$attrs.gutter).assertEqual(str);
console.info('[GridRowJsunit_0300] END'); console.info('[GridRowJsunit_0300] END');
done(); done();
}); });
......
...@@ -91,20 +91,20 @@ export default function ListJsunit() { ...@@ -91,20 +91,20 @@ export default function ListJsunit() {
console.info('[ListJsunit_0200] START'); console.info('[ListJsunit_0200] START');
// Verify onScroll function of List component // Verify onScroll function of List component
let gridTop = CommonFunc.getComponentRect('grid2'); let gridTop = CommonFunc.getComponentRect('list');
let top = gridTop.top let top = gridTop.top
let gridLeft = CommonFunc.getComponentRect('grid2'); let gridBottom = CommonFunc.getComponentRect('list');
let left = gridLeft.left let bottom = gridBottom.bottom
let gridRight = CommonFunc.getComponentRect('grid2'); let gridRight = CommonFunc.getComponentRect('list');
let right = gridRight.right let right = gridRight.right
let driver = await UiDriver.create() let driver = await UiDriver.create()
await driver.swipe(Math.round(left + 50), Math.round(top + 100), Math.round(right - 50), Math.round(top + 100)); await driver.swipe(Math.round(top + 50), Math.round(right - 50), Math.round(bottom - 50), Math.round(right - 50));
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
let onScrollText = await driver.findComponent(BY.key('onScrollText')); let onScrollText = await driver.findComponent(BY.key('onScrollText'));
let text1 = await onScrollText.getText(); let text1 = await onScrollText.getText();
console.info("[ListJsunit_0200] onScrollText: " + text1); console.info("[ListJsunit_0200] onScrollText: " + text1);
expect(text1).assertEqual('onScroll:succ'); expect(text1).assertEqual('onScroll');
// Verify the functions of onReachStart // Verify the functions of onReachStart
await CommonFunc.sleep(200); await CommonFunc.sleep(200);
...@@ -118,34 +118,34 @@ export default function ListJsunit() { ...@@ -118,34 +118,34 @@ export default function ListJsunit() {
let onScrollBeginText = await driver.findComponent(BY.key('onScrollBeginText')); let onScrollBeginText = await driver.findComponent(BY.key('onScrollBeginText'));
let text3 = await onScrollBeginText.getText(); let text3 = await onScrollBeginText.getText();
console.info("[ListJsunit_0200] onScrollBeginText: " + text3); console.info("[ListJsunit_0200] onScrollBeginText: " + text3);
expect(text3).assertEqual('onScrollBegin:succ'); expect(text3).assertEqual('onScrollBegin');
// Verify the functions of onScrollStart // Verify the functions of onScrollStart
await CommonFunc.sleep(200); await CommonFunc.sleep(200);
let onScrollStartText = await driver.findComponent(BY.key('onScrollStartText')); let onScrollStartText = await driver.findComponent(BY.key('onScrollStartText'));
let text4 = await onScrollStartText.getText(); let text4 = await onScrollStartText.getText();
console.info("[ListJsunit_0200] onScrollStartText: " + text4); console.info("[ListJsunit_0200] onScrollStartText: " + text4);
expect(text4).assertEqual('onScrollStart:succ'); expect(text4).assertEqual('onScrollStart');
// Verify the functions of onScrollStop // Verify the functions of onScrollStop
await CommonFunc.sleep(200); await CommonFunc.sleep(200);
let onScrollStopText = await driver.findComponent(BY.key('onScrollStopText')); let onScrollStopText = await driver.findComponent(BY.key('onScrollStopText'));
let text5 = await onScrollStopText.getText(); let text5 = await onScrollStopText.getText();
console.info("[ListJsunit_0200] onScrollStopText: " + text5); console.info("[ListJsunit_0200] onScrollStopText: " + text5);
expect(text5).assertEqual('onScrollStop:succ'); expect(text5).assertEqual('onScrollStop');
// Verify the functions of onReachEnd // Verify the functions of onReachEnd
await driver.swipe(Math.round(right - 50), Math.round(top + 100), Math.round(left + 50), Math.round(top + 100)); await driver.swipe(Math.round(bottom - 50), Math.round(right - 50), Math.round(top + 50), Math.round(right - 50));
await driver.swipe(Math.round(right - 50), Math.round(top + 100), Math.round(left + 50), Math.round(top + 100)); await driver.swipe(Math.round(bottom - 50), Math.round(right - 50), Math.round(top + 50), Math.round(right - 50));
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
await driver.swipe(Math.round(right - 50), Math.round(top + 100), Math.round(left + 50), Math.round(top + 100)); await driver.swipe(Math.round(bottom - 50), Math.round(right - 50), Math.round(top + 50), Math.round(right - 50));
await driver.swipe(Math.round(right - 50), Math.round(top + 100), Math.round(left + 50), Math.round(top + 100)); await driver.swipe(Math.round(bottom - 50), Math.round(right - 50), Math.round(top + 50), Math.round(right - 50));
await driver.swipe(Math.round(right - 50), Math.round(top + 100), Math.round(left + 50), Math.round(top + 100)); await driver.swipe(Math.round(bottom - 50), Math.round(right - 50), Math.round(top + 50), Math.round(right - 50));
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
let onReachEndText = await driver.findComponent(BY.key('onReachEndText')); let onReachEndText = await driver.findComponent(BY.key('onReachEndText'));
let text= await onReachEndText.getText(); let text= await onReachEndText.getText();
console.info("[ListJsunit_0200] onReachEndText: " + text); console.info("[ListJsunit_0200] onReachEndText: " + text);
expect(text).assertEqual('onReachEnd:succ'); expect(text).assertEqual('onReachEnd');
console.info('[ListJsunit_0200] END'); console.info('[ListJsunit_0200] END');
done(); done();
}); });
...@@ -181,7 +181,7 @@ export default function ListJsunit() { ...@@ -181,7 +181,7 @@ export default function ListJsunit() {
await CommonFunc.sleep(200); await CommonFunc.sleep(200);
globalThis.value.message.notify({name:'alignListItem',value:ListItemAlign.Start}) globalThis.value.message.notify({name:'alignListItem',value:ListItemAlign.Start})
await CommonFunc.sleep(200); await CommonFunc.sleep(200);
globalThis.value.message.notify({name:'sticky',value:StickyStyle.Header}) globalThis.value.message.notify({name:'sticky',value:StickyStyle.None})
await CommonFunc.sleep(2000); await CommonFunc.sleep(2000);
// Get the propoties value of the List component // Get the propoties value of the List component
......
...@@ -53,25 +53,14 @@ export default function NavRouterJsunit() { ...@@ -53,25 +53,14 @@ export default function NavRouterJsunit() {
let navRouter2 = await driver.findComponent(BY.key('NavRouter2')); let navRouter2 = await driver.findComponent(BY.key('NavRouter2'));
await navRouter2.click(); await navRouter2.click();
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
let stateChange = await driver.findComponent(BY.id(123)); let stateChange = await driver.findComponent(BY.key('testT'));
await stateChange.click();
await CommonFunc.sleep(1000);
let text1 = await stateChange.getText(); let text1 = await stateChange.getText();
console.info("[NavRouterJsunit_0100] text1: " + JSON.stringify(text1)); console.info("[NavRouterJsunit_0100] text1: " + JSON.stringify(text1));
expect(text1 == 'stateChange true').assertTrue(); expect(text1 == 'stateChange true').assertTrue();
let textComponent = await driver.findComponent(BY.key('textContent'));
let textComponent = await driver.findComponent(BY.key('textContent1'));
let text2 = await textComponent.getText(); let text2 = await textComponent.getText();
console.info("[NavRouterJsunit_0100] text2: " + JSON.stringify(text2)); console.info("[NavRouterJsunit_0100] text2: " + JSON.stringify(text2));
expect(text2 == 'Hello').assertTrue(); expect(text2 == 'Hello').assertTrue();
await CommonFunc.sleep(1000);
let stateChange3 = await driver.findComponent(BY.id(123));
await stateChange3.click();
await CommonFunc.sleep(1000);
let text3 = await stateChange.getText();
console.info("[NavRouterJsunit_0100] text3: " + JSON.stringify(text3));
expect(text3 == 'stateChange false').assertTrue();
console.info('[NavRouterJsunit_0100] END'); console.info('[NavRouterJsunit_0100] END');
done(); done();
}); });
......
...@@ -137,6 +137,8 @@ export default function RatingJsunit() { ...@@ -137,6 +137,8 @@ export default function RatingJsunit() {
// Modify the indicator value of the Rating component // Modify the indicator value of the Rating component
globalThis.value.message.notify({name:'rating',value:1}) globalThis.value.message.notify({name:'rating',value:1})
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
globalThis.value.message.notify({name:'text',value:'no change'})
await CommonFunc.sleep(2000);
let driver = await UiDriver.create() let driver = await UiDriver.create()
let textComponent1 = await driver.findComponent(BY.key('text')); let textComponent1 = await driver.findComponent(BY.key('text'));
......
...@@ -59,15 +59,15 @@ export default function SearchJsunit() { ...@@ -59,15 +59,15 @@ export default function SearchJsunit() {
console.info("[SearchJsunit_0100] textFont: " + JSON.stringify(obj.$attrs.textFont)); console.info("[SearchJsunit_0100] textFont: " + JSON.stringify(obj.$attrs.textFont));
console.info("[SearchJsunit_0100] textAlign: " + JSON.stringify(obj.$attrs.textAlign)); console.info("[SearchJsunit_0100] textAlign: " + JSON.stringify(obj.$attrs.textAlign));
console.info("[SearchJsunit_0100] copyOption: " + JSON.stringify(obj.$attrs.copyOption)); console.info("[SearchJsunit_0100] copyOption: " + JSON.stringify(obj.$attrs.copyOption));
expect(obj.$attrs.inspector.icon).assertEqual('resource:///ohos_search.svg'); expect(obj.$attrs.icon).assertEqual('resource:///ohos_search.svg');
expect(obj.$attrs.inspector.searchButton).assertEqual('SEARCH'); expect(obj.$attrs.searchButton).assertEqual('SEARCH');
expect(obj.$attrs.inspector.placeholderColor).assertEqual('#FF808080'); expect(obj.$attrs.placeholderColor).assertEqual('#FF808080');
expect(obj.$attrs.inspector.value).assertEqual(''); expect(obj.$attrs.value).assertEqual('');
expect(obj.$attrs.inspector.placeholderFont).assertEqual('{"style":"FontStyle.Normal","size":"14.00fp","weight":"400","fontFamily":"sans-serif"}'); expect(obj.$attrs.placeholderFont).assertEqual('{"style":"FontStyle.Normal","size":"14.00fp","weight":"400","fontFamily":"sans-serif"}');
expect(obj.$attrs.inspector.textFont).assertEqual('{"fontSize":"14.00fp","fontStyle":"FontStyle.Normal","fontWeight":"FontWeight.400","fontFamily":"HarmonyOS Sans"}'); expect(obj.$attrs.textFont).assertEqual('{"fontSize":"14.00fp","fontStyle":"FontStyle.Normal","fontWeight":"400","fontFamily":"HarmonyOS Sans"}');
expect(obj.$attrs.inspector.textAlign).assertEqual('TextAlign.Start'); expect(obj.$attrs.textAlign).assertEqual('TextAlign.Start');
expect(obj.$attrs.inspector.copyOption).assertEqual('CopyOptions.InApp'); expect(obj.$attrs.copyOption).assertEqual('CopyOptions.InApp');
expect(obj.$attrs.placeholder.inspector).assertEqual('Type to search...'); expect(obj.$attrs.placeholder).assertEqual('Type to search...');
console.info('[SearchJsunit_0100] END'); console.info('[SearchJsunit_0100] END');
done(); done();
}); });
...@@ -84,11 +84,11 @@ export default function SearchJsunit() { ...@@ -84,11 +84,11 @@ export default function SearchJsunit() {
await CommonFunc.sleep(500); await CommonFunc.sleep(500);
globalThis.value.message.notify({name:'changeValue',value:'hello'}) globalThis.value.message.notify({name:'changeValue',value:'hello'})
await CommonFunc.sleep(500); await CommonFunc.sleep(500);
globalThis.value.message.notify({name:'placeholder',value:'Click to search...'}) globalThis.value.message.notify({name:'placeholder',value:'Type to search...'})
await CommonFunc.sleep(500); await CommonFunc.sleep(500);
globalThis.value.message.notify({name:'fontSize',value:20}) globalThis.value.message.notify({name:'placeholderFont',value:'{"style":"FontStyle.Normal","size":"14.00fp","weight":"400","fontFamily":"sans-serif"}'})
await CommonFunc.sleep(500); await CommonFunc.sleep(500);
globalThis.value.message.notify({name:'weight',value:500}) globalThis.value.message.notify({name:'textFont',value:'{"fontSize":"14.00fp","fontStyle":"FontStyle.Normal","fontWeight":"400","fontFamily":"HarmonyOS Sans"}'})
await CommonFunc.sleep(500); await CommonFunc.sleep(500);
globalThis.value.message.notify({name:'textAlign',value:TextAlign.Center}) globalThis.value.message.notify({name:'textAlign',value:TextAlign.Center})
await CommonFunc.sleep(500); await CommonFunc.sleep(500);
...@@ -113,12 +113,12 @@ export default function SearchJsunit() { ...@@ -113,12 +113,12 @@ export default function SearchJsunit() {
//expect(obj.$attrs.icon).assertEqual('./resources/base/media/star_3.png'); //expect(obj.$attrs.icon).assertEqual('./resources/base/media/star_3.png');
expect(obj.$attrs.searchButton).assertEqual('CLICK_SEARCH'); expect(obj.$attrs.searchButton).assertEqual('CLICK_SEARCH');
expect(obj.$attrs.value).assertEqual('hello'); expect(obj.$attrs.value).assertEqual('hello');
expect(obj.$attrs.placeholderFont).assertEqual('{"style":"FontStyle.Normal","size":"20.00fp","weight":"500","fontFamily":"sans-serif"}'); expect(obj.$attrs.placeholderFont).assertEqual('{"style":"FontStyle.Normal","size":"14.00fp","weight":"400","fontFamily":"sans-serif"}');
expect(obj.$attrs.textFont).assertEqual('{"fontSize":"20.00fp","fontStyle":"FontStyle.Normal","fontWeight":"FontWeight.500","fontFamily":"HarmonyOS Sans"}'); expect(obj.$attrs.textFont).assertEqual('{"fontSize":"14.00fp","fontStyle":"FontStyle.Normal","fontWeight":"400","fontFamily":"HarmonyOS Sans"}');
expect(obj.$attrs.textAlign).assertEqual('TextAlign.Center'); expect(obj.$attrs.textAlign).assertEqual('TextAlign.Center');
expect(obj.$attrs.copyOption).assertEqual('CopyOptions.LocalDevice'); expect(obj.$attrs.copyOption).assertEqual('CopyOptions.Local');
expect(obj.$attrs.placeholderColor).assertEqual('#FF008000'); expect(obj.$attrs.placeholderColor).assertEqual('#FF008000');
expect(obj.$attrs.placeholder).assertEqual('Click to search...'); expect(obj.$attrs.placeholder).assertEqual('Type to search...');
console.info('[SearchJsunit_0200] END'); console.info('[SearchJsunit_0200] END');
done(); done();
}); });
...@@ -202,9 +202,9 @@ export default function SearchJsunit() { ...@@ -202,9 +202,9 @@ export default function SearchJsunit() {
await CommonFunc.sleep(200); await CommonFunc.sleep(200);
globalThis.value.message.notify({name:'placeholder',value:168}) globalThis.value.message.notify({name:'placeholder',value:168})
await CommonFunc.sleep(200); await CommonFunc.sleep(200);
globalThis.value.message.notify({name:'fontSize',value:-20}) globalThis.value.message.notify({name:'placeholderFont',value:'aaa'})
await CommonFunc.sleep(200); await CommonFunc.sleep(500);
globalThis.value.message.notify({name:'weight',value:'test'}) globalThis.value.message.notify({name:'textFont',value:'bbb'})
await CommonFunc.sleep(200); await CommonFunc.sleep(200);
globalThis.value.message.notify({name:'textAlign',value:'test'}) globalThis.value.message.notify({name:'textAlign',value:'test'})
await CommonFunc.sleep(200); await CommonFunc.sleep(200);
...@@ -225,14 +225,14 @@ export default function SearchJsunit() { ...@@ -225,14 +225,14 @@ export default function SearchJsunit() {
console.info("[SearchJsunit_0400] copyOption: " + JSON.stringify(obj.$attrs.copyOption)); console.info("[SearchJsunit_0400] copyOption: " + JSON.stringify(obj.$attrs.copyOption));
console.info("[SearchJsunit_0400] placeholder: " + JSON.stringify(obj.$attrs.placeholder)); console.info("[SearchJsunit_0400] placeholder: " + JSON.stringify(obj.$attrs.placeholder));
expect(obj.$attrs.icon).assertEqual('resource:///ohos_search.svg'); expect(obj.$attrs.icon).assertEqual('resource:///ohos_search.svg');
expect(obj.$attrs.searchButton).assertEqual('10'); expect(obj.$attrs.searchButton).assertEqual('CLICK_SEARCH');
expect(obj.$attrs.placeholderColor).assertEqual('#FF00000A'); expect(obj.$attrs.placeholderColor).assertEqual('#FF00000A');
expect(obj.$attrs.value).assertEqual('hello'); expect(obj.$attrs.value).assertEqual('hello');
expect(obj.$attrs.placeholderFont).assertEqual('{"style":"FontStyle.Normal","size":"14.00fp","weight":"400","fontFamily":"sans-serif"}'); expect(obj.$attrs.placeholderFont).assertEqual('{"style":"FontStyle.Normal","size":"14.00fp","weight":"400","fontFamily":"sans-serif"}');
expect(obj.$attrs.textFont).assertEqual('{"fontSize":"14.00fp","fontStyle":"FontStyle.Normal","fontWeight":"FontWeight.400","fontFamily":"HarmonyOS Sans"}'); expect(obj.$attrs.textFont).assertEqual('{"fontSize":"14.00fp","fontStyle":"FontStyle.Normal","fontWeight":"400","fontFamily":"HarmonyOS Sans"}');
expect(obj.$attrs.textAlign).assertEqual('TextAlign.Start'); expect(obj.$attrs.textAlign).assertEqual('TextAlign.Start');
expect(obj.$attrs.copyOption).assertEqual(''); expect(obj.$attrs.copyOption).assertEqual('');
expect(obj.$attrs.placeholder).assertEqual('Click to search...'); expect(obj.$attrs.placeholder).assertEqual('Type to search...');
console.info('[SearchJsunit_0400] END'); console.info('[SearchJsunit_0400] END');
done(); done();
}); });
......
...@@ -192,9 +192,9 @@ export default function SelectJsunit() { ...@@ -192,9 +192,9 @@ export default function SelectJsunit() {
expect(obj.$attrs.selectedOptionBgColor).assertEqual('#FF0000FF'); expect(obj.$attrs.selectedOptionBgColor).assertEqual('#FF0000FF');
expect(obj.$attrs.selectedOptionFont).assertEqual('{"size":"16.00fp","weight":"400","family":"","style":"FontStyle.Normal"}'); expect(obj.$attrs.selectedOptionFont).assertEqual('{"size":"16.00fp","weight":"400","family":"","style":"FontStyle.Normal"}');
expect(obj.$attrs.selectedOptionFontColor).assertEqual('#FFFFFF00'); expect(obj.$attrs.selectedOptionFontColor).assertEqual('#FFFFFF00');
expect(obj.$attrs.optionBgColor).assertEqual('#FFFFFFFF'); expect(obj.$attrs.optionBgColor).assertEqual('#FF0000FF');
expect(obj.$attrs.optionFont).assertEqual('{"size":"16.00fp","weight":"400","family":"","style":"FontStyle.Normal"}'); expect(obj.$attrs.optionFont).assertEqual('{"size":"16.00fp","weight":"400","family":"","style":"FontStyle.Normal"}');
expect(obj.$attrs.optionFontColor).assertEqual('#FFFF0000'); expect(obj.$attrs.optionFontColor).assertEqual('#FFFFFF00');
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
let driver = await UiDriver.create() let driver = await UiDriver.create()
let textComponent = await driver.findComponent(BY.key('indexValue')); let textComponent = await driver.findComponent(BY.key('indexValue'));
......
...@@ -84,44 +84,31 @@ export default function TextClockJsunit() { ...@@ -84,44 +84,31 @@ export default function TextClockJsunit() {
}); });
it('TextClock_0300', 0, async function (done) { it('TextClock_0300', 0, async function (done) {
// Verify the functions of the button of start and stop // Verify the functions of the button of start
console.info('[TextClock_0300] START'); console.info('[TextClock_0300] START');
// Click stop button
let driver = await UiDriver.create()
let stopButton = await driver.findComponent(BY.text('stop TextClock'));
await stopButton.click();
await CommonFunc.sleep(500);
let accumulateTime1 = await driver.findComponent(BY.key('accumulateTime'));
let text1 = await accumulateTime1.getText();
await CommonFunc.sleep(1000);
let accumulateTime2 = await driver.findComponent(BY.key('accumulateTime'));
let text2 = await accumulateTime2.getText();
expect(text1).assertEqual(text2);
let operation1 = await driver.findComponent(BY.key('operation'));
let textOperation1 = await operation1.getText();
expect(textOperation1).assertEqual('stop success');
let change1 = await driver.findComponent(BY.key('change'));
let textChange1 = await change1.getText();
expect(textChange1).assertEqual('no change success');
// Click start button // Click start button
let driver = await UiDriver.create()
let startButton = await driver.findComponent(BY.text('start TextClock')); let startButton = await driver.findComponent(BY.text('start TextClock'));
await startButton.click(); await startButton.click();
await CommonFunc.sleep(1000);
let accumulateTime1 = await driver.findComponent(BY.key('accumulateTime'));
let text1 = await accumulateTime1.getText();
await CommonFunc.sleep(2000); await CommonFunc.sleep(2000);
let accumulateTime3 = await driver.findComponent(BY.key('accumulateTime')); let accumulateTime2 = await driver.findComponent(BY.key('accumulateTime'));
let text3 = await accumulateTime3.getText(); let text2 = await accumulateTime2.getText();
expect(text2 == text3).assertFalse(); expect(text1 == text2).assertFalse();
console.info("[TextClock_0300] text1 and text2 not equal !");
let change2 = await driver.findComponent(BY.key('change')); let change = await driver.findComponent(BY.key('change'));
let textChange2 = await change2.getText(); let textChange = await change.getText();
expect(textChange2).assertEqual('change success'); expect(textChange).assertEqual('change success');
console.info("[TextClock_0300] change success !");
let operation2 = await driver.findComponent(BY.key('operation')); let operation = await driver.findComponent(BY.key('operation'));
let textOperation2 = await operation2.getText(); let textOperation = await operation.getText();
expect(textOperation2).assertEqual('start success'); expect(textOperation).assertEqual('start success');
console.info("[TextClock_0300] start success !");
console.info('[TextClock_0300] END'); console.info('[TextClock_0300] END');
done(); done();
}); });
......
...@@ -68,7 +68,7 @@ export default function TextInputJsunit() { ...@@ -68,7 +68,7 @@ export default function TextInputJsunit() {
expect(obj.$attrs.enterKeyType).assertEqual('EnterKeyType.Search'); expect(obj.$attrs.enterKeyType).assertEqual('EnterKeyType.Search');
expect(obj.$attrs.caretColor).assertEqual('#FF0000FF'); expect(obj.$attrs.caretColor).assertEqual('#FF0000FF');
expect(obj.$attrs.maxLength).assertEqual('10'); expect(obj.$attrs.maxLength).assertEqual('10');
expect(obj.$attrs.style).assertEqual('TextInputStyle.Inline'); expect(obj.$attrs.style).assertEqual('TextInputStyle.Default');
expect(obj.$attrs.textAlign).assertEqual('TextAlign.Center'); expect(obj.$attrs.textAlign).assertEqual('TextAlign.Center');
expect(obj.$attrs.copyOption).assertEqual('CopyOptions.None'); expect(obj.$attrs.copyOption).assertEqual('CopyOptions.None');
expect(obj.$attrs.showPasswordIcon).assertEqual(false); expect(obj.$attrs.showPasswordIcon).assertEqual(false);
...@@ -191,13 +191,15 @@ export default function TextInputJsunit() { ...@@ -191,13 +191,15 @@ export default function TextInputJsunit() {
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
let textComponent3 = await driver.findComponent(BY.text('全选')); let textComponent3 = await driver.findComponent(BY.text('全选'));
await textComponent3.click() await textComponent3.click()
let textComponent4 = await driver.findComponent(BY.text('复制')); await CommonFunc.sleep(200);
await textComponent4.click() //let textComponent4 = await driver.findComponent(BY.text('复制'));
//await textComponent4.click()
await textComponent.click() await textComponent.click()
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
let copy = await driver.findComponent(BY.key('copy')); let strJson = getInspectorByKey('copy');
let text3 = await copy.getText(); let obj = JSON.parse(strJson);
expect(text3).assertEqual('onCopy:'); console.info("[TextInputJsunit_0400] component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.content).assertEqual('onCopy:');
console.info("[TextInputJsunit_0400] Verify copy succ !"); console.info("[TextInputJsunit_0400] Verify copy succ !");
// Verify onCut function of TextInput component // Verify onCut function of TextInput component
...@@ -205,13 +207,15 @@ export default function TextInputJsunit() { ...@@ -205,13 +207,15 @@ export default function TextInputJsunit() {
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
let textComponent5 = await driver.findComponent(BY.text('全选')); let textComponent5 = await driver.findComponent(BY.text('全选'));
await textComponent5.click() await textComponent5.click()
await CommonFunc.sleep(200);
let textComponent6 = await driver.findComponent(BY.text('剪切')); let textComponent6 = await driver.findComponent(BY.text('剪切'));
await textComponent6.click() await textComponent6.click()
//await textComponent.click() //await textComponent.click()
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
let textComponent7 = await driver.findComponent(BY.key('cut')); let strJson1 = getInspectorByKey('cut');
let text4 = await textComponent7.getText(); let obj1 = JSON.parse(strJson1);
expect(text4).assertEqual('onCut:'); console.info("[TextInputJsunit_0400] component obj1 is: " + JSON.stringify(obj1));
expect(obj1.$attrs.content).assertEqual('onCut:');
console.info("[TextInputJsunit_0400] Verify cut succ !"); console.info("[TextInputJsunit_0400] Verify cut succ !");
console.info('[TextInputJsunit_0400] END'); console.info('[TextInputJsunit_0400] END');
done(); done();
......
...@@ -61,10 +61,10 @@ export default function TextPickerJsunit() { ...@@ -61,10 +61,10 @@ export default function TextPickerJsunit() {
// Get the content of Initial value // Get the content of Initial value
let driver = await UiDriver.create() let driver = await UiDriver.create()
let change = await driver.findComponent(BY.key('text')); let strJson1 = getInspectorByKey('text');
let textChange = await change.getText(); let obj1 = JSON.parse(strJson1);
console.info("[TextPickerJsunit_0100] textChange: " + JSON.stringify(textChange)); console.info("[TextPickerJsunit_0100] obj1: " + JSON.stringify(obj1));
expect(textChange).assertEqual('value: 0'); expect(obj1.$attrs.content).assertEqual('value: 0');
console.info('[TextPickerJsunit_0100] END'); console.info('[TextPickerJsunit_0100] END');
done(); done();
}); });
...@@ -110,10 +110,10 @@ export default function TextPickerJsunit() { ...@@ -110,10 +110,10 @@ export default function TextPickerJsunit() {
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
let driver = await UiDriver.create() let driver = await UiDriver.create()
await driver.swipe(Math.round(right / 2), Math.round(bottom * 2 / 3), Math.round(right / 2), Math.round(bottom / 3)); await driver.swipe(Math.round(right / 2), Math.round(bottom * 2 / 3), Math.round(right / 2), Math.round(bottom / 3));
let change = await driver.findComponent(BY.key('text')); let strJson = getInspectorByKey('text');
let textChange = await change.getText(); let obj = JSON.parse(strJson);
console.info("[TextPickerJsunit_0300] textChange: " + JSON.stringify(textChange)); console.info("[TextPickerJsunit_0300] obj: " + JSON.stringify(obj));
expect(textChange == 'value: 0').assertFalse(); expect(obj.$attrs.content == 'value: 0').assertFalse();
done(); done();
}); });
......
...@@ -76,19 +76,21 @@ export default function imageAniamtorJsunit() { ...@@ -76,19 +76,21 @@ export default function imageAniamtorJsunit() {
let strJson = getInspectorByKey('imageAnimator'); let strJson = getInspectorByKey('imageAnimator');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info('[imageAniamtorJsunit_0200] component obj is: ' + obj.$attrs.state); console.info('[imageAniamtorJsunit_0200] component obj is: ' + obj.$attrs.state);
//expect(obj.$attrs.state).assertEqual('AnimationStatus.Running'); expect(obj.$attrs.state).assertEqual('AnimationStatus.Running');
globalThis.value.message.notify({name:'state',value:AnimationStatus.Paused}) globalThis.value.message.notify({name:'state',value:AnimationStatus.Paused})
await CommonFunc.sleep(5000); await CommonFunc.sleep(1000);
let strJson2 = getInspectorByKey('imageAnimator'); let strJson2 = getInspectorByKey('imageAnimator');
let obj2 = JSON.parse(strJson2); let obj2 = JSON.parse(strJson2);
console.info('[imageAniamtorJsunit_0200] component obj2 is: ' + obj2.$attrs.state); console.info('[imageAniamtorJsunit_0200] component obj2 is: ' + obj2.$attrs.state);
//expect(obj2.$attrs.state).assertEqual('AnimationStatus.Paused'); expect(obj2.$attrs.state).assertEqual('AnimationStatus.Paused');
globalThis.value.message.notify({name:'state',value:AnimationStatus.Stopped}) globalThis.value.message.notify({name:'state',value:AnimationStatus.Stopped})
await CommonFunc.sleep(5000); await CommonFunc.sleep(1000);
let strJson3 = getInspectorByKey('imageAnimator'); let strJson3 = getInspectorByKey('imageAnimator');
let obj3 = JSON.parse(strJson3); let obj3 = JSON.parse(strJson3);
console.info('[imageAniamtorJsunit_0200] component obj3 is: ' + obj3.$attrs.state); console.info('[imageAniamtorJsunit_0200] component obj3 is: ' + obj3.$attrs.state);
//expect(obj3.$attrs.state).assertEqual('AnimationStatus.Stopped'); expect(obj3.$attrs.state).assertEqual('AnimationStatus.Stopped');
console.info('[imageAniamtorJsunit_0200] END'); console.info('[imageAniamtorJsunit_0200] END');
done(); done();
}); });
...@@ -178,13 +180,15 @@ export default function imageAniamtorJsunit() { ...@@ -178,13 +180,15 @@ export default function imageAniamtorJsunit() {
expect(btn != null).assertTrue(); expect(btn != null).assertTrue();
await btn.click(); await btn.click();
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
let textComponent = await driver.findComponent(BY.key('t1')); let strJson = getInspectorByKey('t1');
let text = await textComponent.getText(); let obj = JSON.parse(strJson);
expect(text).assertEqual('start'); console.info("[imageAniamtorJsunit_0700] obj: " + JSON.stringify(obj));
expect(obj.$attrs.content).assertEqual('start');
await CommonFunc.sleep(3000); await CommonFunc.sleep(3000);
let textComponent1 = await driver.findComponent(BY.key('t5')); let strJson1 = getInspectorByKey('t5');
let text1 = await textComponent1.getText(); let obj1 = JSON.parse(strJson1);
expect(text1).assertEqual('onFinish'); console.info("[imageAniamtorJsunit_0700] obj1: " + JSON.stringify(obj1));
expect(obj1.$attrs.content).assertEqual('onFinish');
console.info('imageAniamtorJsunit_0700 END'); console.info('imageAniamtorJsunit_0700 END');
done(); done();
}); });
...@@ -201,7 +205,7 @@ export default function imageAniamtorJsunit() { ...@@ -201,7 +205,7 @@ export default function imageAniamtorJsunit() {
let btn2 = await driver.findComponent(ON.id('start')); let btn2 = await driver.findComponent(ON.id('start'));
expect(btn2 != null).assertTrue(); expect(btn2 != null).assertTrue();
await btn2.click(); await btn2.click();
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('t3'); let strJson = getInspectorByKey('t3');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info('imageAnimatorJsunit_0800 component obj is: '+ obj.$attrs.content); console.info('imageAnimatorJsunit_0800 component obj is: '+ obj.$attrs.content);
......
...@@ -93,6 +93,7 @@ export default function imageOneJsunit() { ...@@ -93,6 +93,7 @@ export default function imageOneJsunit() {
let obj4 = JSON.parse(strJson4); let obj4 = JSON.parse(strJson4);
console.info('textimageOneJsunit_0100 component obj4 is: ' + obj4.$attrs.src); console.info('textimageOneJsunit_0100 component obj4 is: ' + obj4.$attrs.src);
expect(obj4.$attrs.src).assertEqual('resource://rawfile/bm.jpg'); expect(obj4.$attrs.src).assertEqual('resource://rawfile/bm.jpg');
done();
}); });
it('imageOneJsunit_0300', 0, async function (done) { it('imageOneJsunit_0300', 0, async function (done) {
...@@ -105,50 +106,51 @@ export default function imageOneJsunit() { ...@@ -105,50 +106,51 @@ export default function imageOneJsunit() {
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info('textimageOneJsunit_0300 component obj is: ' + obj.$attrs.src); console.info('textimageOneJsunit_0300 component obj is: ' + obj.$attrs.src);
expect(obj.$attrs.src).assertEqual('resource://rawfile/aaa.png'); expect(obj.$attrs.src).assertEqual('resource://rawfile/aaa.png');
done();
}); });
it('imageOneJsunit_0400', 0, async function (done) { it('imageOneJsunit_0400', 0, async function (done) {
console.info('imageOneJsunit_0400 START'); console.info('imageOneJsunit_0400 START');
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
// test the enum of objectFit // test the enum of objectFit
globalThis.value.message.notify({name:'objectFit',value:ImageFit.None}) globalThis.value.message.notify({name:'objectFit',value:ImageFit.Cover})
await CommonFunc.sleep(1000); await CommonFunc.sleep(100);
let strJson = getInspectorByKey('image1'); let strJson = getInspectorByKey('objectFit');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info('textimageOneJsunit_0400 component obj is: ' + obj.$attrs.objectFit); console.info('textimageOneJsunit_0400 component obj is: ' + obj.$attrs.objectFit);
expect(obj.$attrs.objectFit).assertEqual('ImageFit.None'); expect(obj.$attrs.objectFit).assertEqual('ImageFit.Cover');
globalThis.value.message.notify({name:'objectFit',value:'ImageFit.Auto'}) globalThis.value.message.notify({name:'objectFit',value:ImageFit.Auto})
await CommonFunc.sleep(1000); await CommonFunc.sleep(100);
let strJson2 = getInspectorByKey('image1'); let strJson2 = getInspectorByKey('objectFit');
let obj2 = JSON.parse(strJson2); let obj2 = JSON.parse(strJson2);
console.info('textimageOneJsunit_0400 component obj2 is: ' + obj2.$attrs.objectFit); console.info('textimageOneJsunit_0400 component obj2 is: ' + obj2.$attrs.objectFit);
expect(obj2.$attrs.objectFit).assertEqual('ImageFit.Auto'); expect(obj2.$attrs.objectFit).assertEqual('ImageFit.Auto');
globalThis.value.message.notify({name:'objectFit',value:ImageFit.Fill}) globalThis.value.message.notify({name:'objectFit',value:ImageFit.Fill})
await CommonFunc.sleep(1000); await CommonFunc.sleep(100);
let strJson3 = getInspectorByKey('image1'); let strJson3 = getInspectorByKey('objectFit');
let obj3 = JSON.parse(strJson3); let obj3 = JSON.parse(strJson3);
console.info('textimageOneJsunit_0400 component obj3 is: ' + obj3.$attrs.objectFit); console.info('textimageOneJsunit_0400 component obj3 is: ' + obj3.$attrs.objectFit);
expect(obj3.$attrs.objectFit).assertEqual('ImageFit.Fill'); expect(obj3.$attrs.objectFit).assertEqual('ImageFit.Fill');
globalThis.value.message.notify({name:'objectFit',value:ImageFit.ScaleDown}) globalThis.value.message.notify({name:'objectFit',value:ImageFit.ScaleDown})
await CommonFunc.sleep(1000); await CommonFunc.sleep(100);
let strJson4 = getInspectorByKey('image1'); let strJson4 = getInspectorByKey('objectFit');
let obj4 = JSON.parse(strJson4); let obj4 = JSON.parse(strJson4);
console.info('textimageOneJsunit_0400 component obj4 is: ' + obj4.$attrs.objectFit); console.info('textimageOneJsunit_0400 component obj4 is: ' + obj4.$attrs.objectFit);
expect(obj4.$attrs.objectFit).assertEqual('ImageFit.ScaleDown'); expect(obj4.$attrs.objectFit).assertEqual('ImageFit.ScaleDown');
globalThis.value.message.notify({name:'objectFit',value:ImageFit.Cover}) globalThis.value.message.notify({name:'objectFit',value:ImageFit.None})
await CommonFunc.sleep(1000); await CommonFunc.sleep(100);
let strJson5 = getInspectorByKey('image1'); let strJson5 = getInspectorByKey('objectFit');
let obj5 = JSON.parse(strJson5); let obj5 = JSON.parse(strJson5);
console.info('textimageOneJsunit_0400 component obj5 is: ' + obj5.$attrs.objectFit); console.info('textimageOneJsunit_0400 component obj5 is: ' + obj5.$attrs.objectFit);
expect(obj5.$attrs.objectFit).assertEqual('ImageFit.Cover'); expect(obj5.$attrs.objectFit).assertEqual('ImageFit.None');
globalThis.value.message.notify({name:'objectFit',value:ImageFit.Contain}) globalThis.value.message.notify({name:'objectFit',value:ImageFit.Contain})
await CommonFunc.sleep(1000); await CommonFunc.sleep(100);
let strJson6 = getInspectorByKey('image1'); let strJson6 = getInspectorByKey('objectFit');
let obj6 = JSON.parse(strJson6); let obj6 = JSON.parse(strJson6);
console.info('textimageOneJsunit_0400 component obj6 is: ' + obj6.$attrs.objectFit); console.info('textimageOneJsunit_0400 component obj6 is: ' + obj6.$attrs.objectFit);
expect(obj6.$attrs.objectFit).assertEqual('ImageFit.Contain'); expect(obj6.$attrs.objectFit).assertEqual('ImageFit.Contain');
......
...@@ -24,13 +24,13 @@ export default function imageThreeJsunit() { ...@@ -24,13 +24,13 @@ export default function imageThreeJsunit() {
beforeEach(async function (done) { beforeEach(async function (done) {
console.info("imageThreeJsunit beforeEach start"); console.info("imageThreeJsunit beforeEach start");
let options = { let options = {
uri: 'MainAbility/pages/imagethree', uri: 'MainAbility/pages/imageThree',
} }
try { try {
router.clear(); router.clear();
let pages = router.getState(); let pages = router.getState();
console.info("get imageThreeJsunit state pages:" + JSON.stringify(pages)); console.info("get imageThreeJsunit state pages:" + JSON.stringify(pages));
if (!("imagethree" == pages.name)) { if (!("imageThree" == pages.name)) {
console.info("get imageThreeJsunit state pages.name:" + JSON.stringify(pages.name)); console.info("get imageThreeJsunit state pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options); let result = await router.push(options);
console.info("push imageThreeJsunit success " + JSON.stringify(result)); console.info("push imageThreeJsunit success " + JSON.stringify(result));
...@@ -46,53 +46,50 @@ export default function imageThreeJsunit() { ...@@ -46,53 +46,50 @@ export default function imageThreeJsunit() {
console.info('imageThreeJsunit_0100 START'); console.info('imageThreeJsunit_0100 START');
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
// test the image complete Event // test the image complete Event
let driver = await UiDriver.create() await CommonFunc.sleep(1000);
await CommonFunc.sleep(2000); let strJson = getInspectorByKey('complete');
let textComponent = await driver.findComponent(BY.text('complete')); let obj = JSON.parse(strJson);
let text = await textComponent.getText(); console.info("[imageThreeJsunit_0100] component obj is: " + JSON.stringify(obj));
console.info('imageThreeJsunit_0100 text: ' + text); expect(obj.$attrs.content).assertEqual('complete');
expect(text).assertEqual('complete');
done(); done();
}); });
it('imageThreeJsunit_0200', 0, async function (done) { it('imageThreeJsunit_0200', 0, async function (done) {
console.info('imageThreeJsunit_0200 START'); console.info('imageThreeJsunit_0100 START');
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
// test the image error event // test the image finish Event
globalThis.value.message.notify({name:'name',value:'1.png'}) let strJson = getInspectorByKey('Finish');
await CommonFunc.sleep(3000); let obj = JSON.parse(strJson);
let driver = await UiDriver.create() console.info("[imageThreeJsunit_0200] component obj is: " + JSON.stringify(obj));
let textComponent = await driver.findComponent(BY.key('error')); expect(obj.$attrs.content).assertEqual('init');
let text = await textComponent.getText();
console.info('imageThreeJsunit_0200 text: ' + text);
expect(text).assertEqual('error');
done(); done();
}); });
it('imageThreeJsunit_0300', 0, async function (done) { it('imageThreeJsunit_0300', 0, async function (done) {
console.info('imageThreeJsunit_0300 START'); console.info('imageThreeJsunit_0300 START');
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
// test the image click event // test the image click event
let driver = UiDriver.create(); let driver = UiDriver.create();
let btn = await driver.findComponent(BY.key('click')); let btn = await driver.findComponent(BY.key('image2'));
await btn.click(); await btn.click();
await CommonFunc.sleep(1000); await CommonFunc.sleep(100);
let textComponent = await driver.findComponent(BY.key('click')); let strJson = getInspectorByKey('click');
let text = await textComponent.getText(); let obj = JSON.parse(strJson);
console.info('imageThreeJsunit_0300 text: ' + text); console.info("[imageThreeJsunit_0300] component obj is: " + JSON.stringify(obj));
expect(text).assertEqual('click'); expect(obj.$attrs.content).assertEqual('click');
done(); done();
}); });
it('imageThreeJsunit_0400', 0, async function (done) { it('imageThreeJsunit_0400', 0, async function (done) {
console.info('imageThreeJsunit_0100 START'); console.info('imageThreeJsunit_0200 START');
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
// test the image finish Event // test the image error event
let driver = UiDriver.create(); globalThis.value.message.notify({name:'imageName',value:'1.png'})
let textComponent = await driver.findComponent(BY.key('Finish')); await CommonFunc.sleep(300);
let text = await textComponent.getText(); let strJson = getInspectorByKey('error');
console.info('imageThreeJsunit_0400 text: ' + text); let obj = JSON.parse(strJson);
expect(text).assertEqual('Finish'); console.info("[imageThreeJsunit_0400] component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.content).assertEqual('error');
done(); done();
}); });
}) })
......
...@@ -66,11 +66,12 @@ export default function imageTwoJsunit() { ...@@ -66,11 +66,12 @@ export default function imageTwoJsunit() {
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
// modify the image rendermode // modify the image rendermode
globalThis.value.message.notify({name:'renderMode',value:ImageRenderMode.Template}) globalThis.value.message.notify({name:'renderMode',value:ImageRenderMode.Template})
await CommonFunc.sleep(1000); await CommonFunc.sleep(200);
let strJson = getInspectorByKey('image1'); let strJson = getInspectorByKey('image1');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info('imageTwoJsunit_0200 component obj is: ' + obj.$attrs.renderMode); console.info('imageTwoJsunit_0200 component obj is: ' + obj.$attrs.renderMode);
expect(obj.$attrs.renderMode).assertEqual('ImageRenderMode.Template'); expect(obj.$attrs.renderMode).assertEqual('ImageRenderMode.Template');
done();
}); });
it('imageTwoJsunit_0300', 0, async function (done) { it('imageTwoJsunit_0300', 0, async function (done) {
...@@ -78,11 +79,11 @@ export default function imageTwoJsunit() { ...@@ -78,11 +79,11 @@ export default function imageTwoJsunit() {
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
// modify the image rendermode // modify the image rendermode
globalThis.value.message.notify({name:'renderMode',value:undefined}) globalThis.value.message.notify({name:'renderMode',value:undefined})
await CommonFunc.sleep(3000); await CommonFunc.sleep(200);
let strJson = getInspectorByKey('image1'); let strJson = getInspectorByKey('image1');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info('imageTwoJsunit_0300 component obj is: ' + obj.$attrs.renderMode); console.info('imageTwoJsunit_0300 component obj is: ' + obj.$attrs.renderMode);
expect(obj.$attrs.renderMode).assertEqual('ImageRenderMode.Template'); expect(obj.$attrs.renderMode).assertEqual('ImageRenderMode.Original');
done(); done();
}); });
...@@ -91,21 +92,21 @@ export default function imageTwoJsunit() { ...@@ -91,21 +92,21 @@ export default function imageTwoJsunit() {
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
// test the enum of interpolation // test the enum of interpolation
globalThis.value.message.notify({name:'interpolation',value:ImageInterpolation.Low}) globalThis.value.message.notify({name:'interpolation',value:ImageInterpolation.Low})
await CommonFunc.sleep(3000); await CommonFunc.sleep(300);
let strJson = getInspectorByKey('image1'); let strJson = getInspectorByKey('image1');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info('imageTwoJsunit_0300 component obj is: ' + obj.$attrs.interpolation); console.info('imageTwoJsunit_0300 component obj is: ' + obj.$attrs.interpolation);
expect(obj.$attrs.interpolation).assertEqual('ImageInterpolation.Low'); expect(obj.$attrs.interpolation).assertEqual('ImageInterpolation.Low');
globalThis.value.message.notify({name:'interpolation',value:ImageInterpolation.Medium}) globalThis.value.message.notify({name:'interpolation',value:ImageInterpolation.Medium})
await CommonFunc.sleep(3000); await CommonFunc.sleep(300);
let strJson2 = getInspectorByKey('image1'); let strJson2 = getInspectorByKey('image1');
let obj2 = JSON.parse(strJson2); let obj2 = JSON.parse(strJson2);
console.info('imageTwoJsunit_0400 component obj2 is: ' + obj2.$attrs.interpolation); console.info('imageTwoJsunit_0400 component obj2 is: ' + obj2.$attrs.interpolation);
expect(obj2.$attrs.interpolation).assertEqual('ImageInterpolation.Medium'); expect(obj2.$attrs.interpolation).assertEqual('ImageInterpolation.Medium');
globalThis.value.message.notify({name:'interpolation',value:ImageInterpolation.High}) globalThis.value.message.notify({name:'interpolation',value:ImageInterpolation.High})
await CommonFunc.sleep(3000); await CommonFunc.sleep(300);
let strJson3 = getInspectorByKey('image1'); let strJson3 = getInspectorByKey('image1');
let obj3 = JSON.parse(strJson3); let obj3 = JSON.parse(strJson3);
console.info('imageTwoJsunit_0400 component obj3 is: ' + obj3.$attrs.interpolation); console.info('imageTwoJsunit_0400 component obj3 is: ' + obj3.$attrs.interpolation);
...@@ -118,11 +119,11 @@ export default function imageTwoJsunit() { ...@@ -118,11 +119,11 @@ export default function imageTwoJsunit() {
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
// test the enum of interpolation // test the enum of interpolation
globalThis.value.message.notify({name:'interpolation',value:undefined}) globalThis.value.message.notify({name:'interpolation',value:undefined})
await CommonFunc.sleep(2000); await CommonFunc.sleep(200);
let strJson = getInspectorByKey('image1'); let strJson = getInspectorByKey('image1');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info('imageTwoJsunit_0500 component obj is: ' + obj.$attrs.interpolation); console.info('imageTwoJsunit_0500 component obj is: ' + obj.$attrs.interpolation);
expect(obj.$attrs.interpolation).assertEqual('ImageInterpolation.High'); expect(obj.$attrs.interpolation).assertEqual('ImageInterpolation.None');
done(); done();
}); });
...@@ -130,7 +131,7 @@ export default function imageTwoJsunit() { ...@@ -130,7 +131,7 @@ export default function imageTwoJsunit() {
console.info('imageOneJsunit_0600 START'); console.info('imageOneJsunit_0600 START');
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
globalThis.value.message.notify({name:'fillColor',value:"#FFEEAA"}) globalThis.value.message.notify({name:'fillColor',value:"#FFEEAA"})
await CommonFunc.sleep(2000); await CommonFunc.sleep(200);
let strJson = getInspectorByKey('image1'); let strJson = getInspectorByKey('image1');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info('imageOneJsunit_0600 component obj is: ' + obj.$attrs.fillColor); console.info('imageOneJsunit_0600 component obj is: ' + obj.$attrs.fillColor);
......
...@@ -30,7 +30,7 @@ export default function marqueeJsunit() { ...@@ -30,7 +30,7 @@ export default function marqueeJsunit() {
router.clear(); router.clear();
let pages = router.getState(); let pages = router.getState();
console.info("get marqueeJsunit state pages:" + JSON.stringify(pages)); console.info("get marqueeJsunit state pages:" + JSON.stringify(pages));
if (!("marguee" == pages.name)) { if (!("marquee" == pages.name)) {
console.info("get marqueeJsunit state pages.name:" + JSON.stringify(pages.name)); console.info("get marqueeJsunit state pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options); let result = await router.push(options);
console.info("push marqueeJsunit success " + JSON.stringify(result)); console.info("push marqueeJsunit success " + JSON.stringify(result));
...@@ -63,7 +63,7 @@ export default function marqueeJsunit() { ...@@ -63,7 +63,7 @@ export default function marqueeJsunit() {
console.info('marqueeJsunit_0200 START'); console.info('marqueeJsunit_0200 START');
// modify the type attribute normal value of marquee dynamically // modify the type attribute normal value of marquee dynamically
globalThis.value.message.notify({name:'fromStart',value:true}) globalThis.value.message.notify({name:'fromStart',value:true})
await CommonFunc.sleep(2000); await CommonFunc.sleep(200);
// check the value of changed parameter // check the value of changed parameter
let strJson = getInspectorByKey('marquee'); let strJson = getInspectorByKey('marquee');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
...@@ -72,31 +72,6 @@ export default function marqueeJsunit() { ...@@ -72,31 +72,6 @@ export default function marqueeJsunit() {
}); });
it('marqueeJsunit_0300', 0, async function (done) { it('marqueeJsunit_0300', 0, async function (done) {
console.info('marqueeJsunit_0300 START');
await CommonFunc.sleep(1000);
// modify the values partly attribute illegal value of marguee dynamically
globalThis.value.message.notify({name:'loop',value:-30})
await CommonFunc.sleep(1000);
// check the value of changed attribute
let strJson = getInspectorByKey('marquee');
let obj = JSON.parse(strJson);
expect(obj.$attrs.loop).assertEqual('2');
done();
});
it('marqueeJsunit_0400', 0, async function (done) {
console.info('marqueeJsunit_0400 START');
// modify the type attribute normal value of marquee dynamically
globalThis.value.message.notify({name:'step',value:50})
await CommonFunc.sleep(2000);
// check the value of changed parameter
let strJson = getInspectorByKey('marquee');
let obj = JSON.parse(strJson);
expect(obj.$attrs.step).assertEqual('50.000000');
done();
});
it('marqueeJsunit_0500', 0, async function (done) {
console.info('marqueeJsunit_0400 START'); console.info('marqueeJsunit_0400 START');
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
// test event // test event
...@@ -109,18 +84,44 @@ export default function marqueeJsunit() { ...@@ -109,18 +84,44 @@ export default function marqueeJsunit() {
// check the test event // check the test event
let ttx = await driver.findComponent(ON.id('text1')); let ttx = await driver.findComponent(ON.id('text1'));
let txt = await ttx.getText(); let txt = await ttx.getText();
console.info("[marqueeJsunit_0500'] component obj is: " + txt); console.info("[marqueeJsunit_0300'] component obj is: " + txt);
expect(txt == 'onStart').assertTrue(); expect(txt == 'onStart').assertTrue();
let ttxx = await driver.findComponent(ON.id('text2')); let ttxx = await driver.findComponent(ON.id('text2'));
let txtt = await ttxx.getText(); let txtt = await ttxx.getText();
console.info("[marqueeJsunit_0500'] component obj2 is: " + txtt); console.info("[marqueeJsunit_0300'] component obj2 is: " + txtt);
expect(txtt == 'onBounce').assertTrue(); expect(txtt == 'onBounce').assertTrue();
await driver.delayMs(1000);
let ttxxx = await driver.findComponent(ON.id('text3')); let ttxxx = await driver.findComponent(ON.id('text3'));
let txttt = await ttxxx.getText(); let txttt = await ttxxx.getText();
console.info("[marqueeJsunit_0500'] component obj3 is: " + txttt); console.info("[marqueeJsunit_0300'] component obj3 is: " + txttt);
expect(txttt == 'onFinish').assertTrue(); expect(txttt == 'onFinish').assertTrue();
done(); done();
}); });
it('marqueeJsunit_0400', 0, async function (done) {
console.info('marqueeJsunit_0300 START');
await CommonFunc.sleep(100);
// modify the values partly attribute illegal value of marguee dynamically
globalThis.value.message.notify({name:'loop',value:-30})
await CommonFunc.sleep(1000);
// check the value of changed attribute
let strJson = getInspectorByKey('marquee');
let obj = JSON.parse(strJson);
expect(obj.$attrs.loop).assertEqual('-30');
done();
});
it('marqueeJsunit_0500', 0, async function (done) {
console.info('marqueeJsunit_0400 START');
// modify the type attribute normal value of marquee dynamically
globalThis.value.message.notify({name:'step',value:50})
await CommonFunc.sleep(200);
// check the value of changed parameter
let strJson = getInspectorByKey('marquee');
let obj = JSON.parse(strJson);
expect(obj.$attrs.step).assertEqual('50.000000');
done();
});
it('marqueeJsunit_0600', 0, async function (done) { it('marqueeJsunit_0600', 0, async function (done) {
console.info('marqueeJsunit_0600 START'); console.info('marqueeJsunit_0600 START');
...@@ -130,7 +131,7 @@ export default function marqueeJsunit() { ...@@ -130,7 +131,7 @@ export default function marqueeJsunit() {
let strJson = getInspectorByKey('marquee'); let strJson = getInspectorByKey('marquee');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
// to confirm // to confirm
expect(obj.$attrs.step).assertEqual('50.000000'); expect(obj.$attrs.step).assertEqual('-30.000000');
done(); done();
}); });
...@@ -138,7 +139,7 @@ export default function marqueeJsunit() { ...@@ -138,7 +139,7 @@ export default function marqueeJsunit() {
console.info('marqueeJsunit_0700 START'); console.info('marqueeJsunit_0700 START');
// modify the type attribute normal value of marquee dynamically // modify the type attribute normal value of marquee dynamically
globalThis.value.message.notify({name:'loop',value:2}) globalThis.value.message.notify({name:'loop',value:2})
await CommonFunc.sleep(1000); await CommonFunc.sleep(100);
let strJson = getInspectorByKey('marquee'); let strJson = getInspectorByKey('marquee');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
expect(obj.$attrs.loop).assertEqual('2'); expect(obj.$attrs.loop).assertEqual('2');
...@@ -148,13 +149,12 @@ export default function marqueeJsunit() { ...@@ -148,13 +149,12 @@ export default function marqueeJsunit() {
it('marqueeJsunit_0800', 0, async function (done) { it('marqueeJsunit_0800', 0, async function (done) {
console.info('marqueeJsunit_0800 START'); console.info('marqueeJsunit_0800 START');
// modify the type attribute normal value of marquee dynamically // modify the type attribute normal value of marquee dynamically
globalThis.value.message.notify({name:'src',value:'starts rolling'}) globalThis.value.message.notify({name:'src',value:'Running Marquee starts rolling'})
await CommonFunc.sleep(2000); await CommonFunc.sleep(200);
let strJson = getInspectorByKey('marquee'); let strJson = getInspectorByKey('marquee');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
expect(obj.$attrs.src).assertEqual('Running Marquee starts rolling'); expect(obj.$attrs.src).assertEqual('Running Marquee starts rolling');
done(); done();
}); });
}) })
} }
\ No newline at end of file
...@@ -125,7 +125,7 @@ export default function sliderJsunit() { ...@@ -125,7 +125,7 @@ export default function sliderJsunit() {
console.info('sliderJsunit_0500 component obj is: ' + obj.$attrs.blockColor + "---" + obj.$attrs.trackColor + "--" + obj.$attrs.selectedColor + "--" ); console.info('sliderJsunit_0500 component obj is: ' + obj.$attrs.blockColor + "---" + obj.$attrs.trackColor + "--" + obj.$attrs.selectedColor + "--" );
expect(obj.$attrs.blockColor).assertEqual('#FFEE82EE'); expect(obj.$attrs.blockColor).assertEqual('#FFEE82EE');
expect(obj.$attrs.trackColor).assertEqual('#FFEE82EE'); expect(obj.$attrs.trackColor).assertEqual('#FFEE82EE');
expect(obj.$attrs.selectedColor).assertEqual('#FFAEFFFF'); expect(obj.$attrs.selectedColor).assertEqual('#FFEE82EE');
done(); done();
}); });
...@@ -154,7 +154,7 @@ export default function sliderJsunit() { ...@@ -154,7 +154,7 @@ export default function sliderJsunit() {
it('sliderJsunit_0700', 0, async function (done) { it('sliderJsunit_0700', 0, async function (done) {
console.info('sliderJsunit_0700 START'); console.info('sliderJsunit_0700 START');
// modify the constructor attribute of slider dynamically // modify the constructor attribute of slider dynamically
globalThis.value.message.notify({name:'value',value:30}) globalThis.value.message.notify({name:'vInSetValueOne',value:30})
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
globalThis.value.message.notify({name:'style',value:SliderStyle.OutSet}) globalThis.value.message.notify({name:'style',value:SliderStyle.OutSet})
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
...@@ -182,11 +182,36 @@ export default function sliderJsunit() { ...@@ -182,11 +182,36 @@ export default function sliderJsunit() {
expect(obj.$attrs.constructor.value).assertEqual('30.000000'); expect(obj.$attrs.constructor.value).assertEqual('30.000000');
done(); done();
}); });
it('sliderJsunit_0800', 0, async function (done) { it('sliderJsunit_0800', 0, async function (done) {
// Verify the swipe function of slider component
console.info('sliderJsunit_0800 START'); console.info('sliderJsunit_0800 START');
await CommonFunc.sleep(1000);
let sliderT = CommonFunc.getComponentRect('sliderConstructor');
let top = sliderT.top
let bottom = sliderT.bottom
let left = sliderT.left
let right = sliderT.right
let x = Math.round(left + (right - left) / 2)
let driver = await Driver.create();
await driver.delayMs(waitUiReadyMs);
await driver.swipe(x, Math.round(bottom - 20), x, Math.round(top + 50));
await driver.delayMs(waitUiReadyMs);
let strJson = getInspectorByKey('tex');
let obj = JSON.parse(strJson);
console.info("[sliderJsunit_0800] obj: " + JSON.stringify(obj));
expect(obj.$attrs.content).assertEqual('30');
let strJson1 = getInspectorByKey('modeT');
let obj1 = JSON.parse(strJson1);
console.info("[sliderJsunit_0800] obj1: " + JSON.stringify(obj1));
expect(obj1.$attrs.content).assertEqual('mode');
done();
});
it('sliderJsunit_0900', 0, async function (done) {
console.info('[sliderJsunit_0800] START');
// modify the constructor attribute of slider dynamically // modify the constructor attribute of slider dynamically
globalThis.value.message.notify({name:'value',value:-30}) globalThis.value.message.notify({name:'vInSetValueOne',value:-30})
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
globalThis.value.message.notify({name:'reverse',value:1}) globalThis.value.message.notify({name:'reverse',value:1})
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
...@@ -203,42 +228,16 @@ export default function sliderJsunit() { ...@@ -203,42 +228,16 @@ export default function sliderJsunit() {
// check the value of changed parameter // check the value of changed parameter
let strJson = getInspectorByKey('sliderConstructor'); let strJson = getInspectorByKey('sliderConstructor');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info('sliderJsunit_0200 component obj is: ' + obj.$attrs.style + "---" + obj.$attrs.constructor.direction + "--" + obj.$attrs.constructor.value console.info('[sliderJsunit_0900] component obj is: ' + obj.$attrs.style + "---" + obj.$attrs.constructor.direction + "--" + obj.$attrs.constructor.value
+ "---" + obj.$attrs.constructor.reverse + "----" + obj.$attrs.constructor.min + "----" + obj.$attrs.constructor.max + "---" + obj.$attrs.constructor.step); + "---" + obj.$attrs.constructor.reverse + "----" + obj.$attrs.constructor.min + "----" + obj.$attrs.constructor.max + "---" + obj.$attrs.constructor.step);
expect(obj.$attrs.style).assertEqual('SliderStyle.OutSet'); expect(obj.$attrs.style).assertEqual('SliderStyle.OutSet');
expect(obj.$attrs.constructor.direction).assertEqual('Axis.Horizontal'); expect(obj.$attrs.constructor.direction).assertEqual('Axis.Horizontal');
expect(obj.$attrs.constructor.value).assertEqual('40.000000'); expect(obj.$attrs.constructor.value).assertEqual('20.000000');
expect(obj.$attrs.constructor.reverse).assertEqual('false'); expect(obj.$attrs.constructor.reverse).assertEqual('false');
expect(obj.$attrs.constructor.min).assertEqual('-20.000000'); expect(obj.$attrs.constructor.min).assertEqual('-20.000000');
expect(obj.$attrs.constructor.max).assertEqual('1000.000000'); expect(obj.$attrs.constructor.max).assertEqual('1000.000000');
expect(obj.$attrs.constructor.step).assertEqual('1.000000'); expect(obj.$attrs.constructor.step).assertEqual('1.000000');
done(); console.info('[sliderJsunit_0900] END');
});
it('sliderJsunit_0900', 0, async function (done) {
// Verify the swipe function of slider component
console.info('sliderJsunit_0900 START');
await CommonFunc.sleep(1000);
let sliderT = CommonFunc.getComponentRect('sliderConstructor2');
let top = sliderT.top
let sliderB = CommonFunc.getComponentRect('sliderConstructor2');
let bottom = sliderB.bottom
let sliderL = CommonFunc.getComponentRect('sliderConstructor2');
let left = sliderL.left
let sliderR = CommonFunc.getComponentRect('sliderConstructor2');
let right = sliderR.right
let driver = await Driver.create();
await driver.delayMs(waitUiReadyMs);
await driver.swipe(Math.round((right - left) / 2), Math.round(bottom - 10), Math.round((right - left) / 2), Math.round(top + 10));
await driver.delayMs(waitUiReadyMs);
let textIn = await driver.findComponent(ON.id('tex'));
let txt = await textIn.getText();
console.info('sliderJsunit_0900 component textIn obj is: ' + txt);
expect(txt).assertEqual('40');
let modeT = await driver.findComponent(ON.id('modeT'));
let txtt = await modeT.getText();
console.info('sliderJsunit_0900 modeT component obj is: ' + txtt);
expect(txtt).assertEqual('mode');
done(); done();
}); });
}) })
......
...@@ -120,13 +120,19 @@ export default function stepperJsunit() { ...@@ -120,13 +120,19 @@ export default function stepperJsunit() {
it('stepperJsunit_0600', 0, async function (done) { it('stepperJsunit_0600', 0, async function (done) {
console.info('stepperJsunit_0600 START'); console.info('stepperJsunit_0600 START');
// reset the component init status
globalThis.value.message.notify({name:'nextLabel',value:'下一步'});
await CommonFunc.sleep(1000);
globalThis.value.message.notify({name:'prevLabel',value:'返回'});
await CommonFunc.sleep(1000);
globalThis.value.message.notify({name:'status',value:ItemState.Normal});
// test the stepper onChange onNext onPrevious event // test the stepper onChange onNext onPrevious event
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
let driver = UiDriver.create(); let driver = UiDriver.create();
let button = await driver.findComponent(BY.text('Next')); let button = await driver.findComponent(BY.text('Next'));
await button.click(); await button.click();
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
let button2 = await driver.findComponent(BY.text('Next')); let button2 = await driver.findComponent(BY.text('下一步'));
await button2.click(); await button2.click();
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
let textThree = await driver.findComponent(BY.text('Page Three')); let textThree = await driver.findComponent(BY.text('Page Three'));
...@@ -148,19 +154,20 @@ export default function stepperJsunit() { ...@@ -148,19 +154,20 @@ export default function stepperJsunit() {
// test the stepper onFinish event // test the stepper onFinish event
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
let driver = UiDriver.create(); let driver = UiDriver.create();
let button = await driver.findComponent(BY.text('Next'));
await button.click();
await CommonFunc.sleep(2000); await CommonFunc.sleep(2000);
let button2 = await driver.findComponent(BY.text('下一步')); let button2 = await driver.findComponent(BY.text('下一步'));
await button2.click(); await button2.click();
await CommonFunc.sleep(2000); await CommonFunc.sleep(2000);
let button3 = await driver.findComponent(BY.text('开始')); let button3 = await driver.findComponent(BY.text('下一步'));
await button3.click(); await button3.click();
await CommonFunc.sleep(2000); await CommonFunc.sleep(2000);
let textTwo = await driver.findComponent(BY.text('Page One')); let button4 = await driver.findComponent(BY.text('开始'));
await button4.click();
await CommonFunc.sleep(2000);
let textTwo = await driver.findComponent(BY.text('Page Four'));
let txtT = await textTwo.getText(); let txtT = await textTwo.getText();
console.info('stepperJsunit_0700 component obj is: ' + txtT); console.info('stepperJsunit_0700 component obj is: ' + txtT);
expect(txtT).assertEqual('Page One'); expect(txtT).assertEqual('Page Four');
done(); done();
}); });
...@@ -169,12 +176,9 @@ export default function stepperJsunit() { ...@@ -169,12 +176,9 @@ export default function stepperJsunit() {
// test the stepper onSkip event // test the stepper onSkip event
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
let driver = UiDriver.create(); let driver = UiDriver.create();
let button = await driver.findComponent(BY.key('btStp')); let button = await driver.findComponent(BY.text('返回'));
await button.click(); await button.click();
await CommonFunc.sleep(2000); await CommonFunc.sleep(2000);
let button2 = await driver.findComponent(BY.text('跳过'));
await button2.click();
await CommonFunc.sleep(2000);
let textTwo = await driver.findComponent(BY.text('Page Three')); let textTwo = await driver.findComponent(BY.text('Page Three'));
let txtT = await textTwo.getText(); let txtT = await textTwo.getText();
console.info('stepperJsunit_0800 component obj is: ' + txtT); console.info('stepperJsunit_0800 component obj is: ' + txtT);
...@@ -182,4 +186,4 @@ export default function stepperJsunit() { ...@@ -182,4 +186,4 @@ export default function stepperJsunit() {
done(); done();
}); });
}) })
} }
\ No newline at end of file
...@@ -56,7 +56,6 @@ export default function textAreaJsunit() { ...@@ -56,7 +56,6 @@ export default function textAreaJsunit() {
expect(obj.$attrs.placeholderColor).assertEqual('#FFAACCEE'); expect(obj.$attrs.placeholderColor).assertEqual('#FFAACCEE');
expect(obj.$attrs.textAlign).assertEqual('TextAlign.End'); expect(obj.$attrs.textAlign).assertEqual('TextAlign.End');
expect(obj.$attrs.caretColor).assertEqual('#FFACDEFF'); expect(obj.$attrs.caretColor).assertEqual('#FFACDEFF');
expect(obj.$attrs.inputFilter).assertEqual('shang');
expect(obj.$attrs.fontSize).assertEqual('16.00fp'); expect(obj.$attrs.fontSize).assertEqual('16.00fp');
expect(obj.$attrs.copyOption).assertEqual('CopyOptions.Local'); expect(obj.$attrs.copyOption).assertEqual('CopyOptions.Local');
done(); done();
...@@ -73,7 +72,7 @@ export default function textAreaJsunit() { ...@@ -73,7 +72,7 @@ export default function textAreaJsunit() {
let strJson = getInspectorByKey('textArea'); let strJson = getInspectorByKey('textArea');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info('textAreaJsunit_0200 component obj is: ' + obj.$attrs.placeholderFont); console.info('textAreaJsunit_0200 component obj is: ' + obj.$attrs.placeholderFont);
//expect(obj.$attrs.placeholderFont).assertEqual('{"style":"FontStyle.Normal","size":"20.00fp","weight":"300","fontFamily":"sans-serif"}'); expect(obj.$attrs.placeholderFont).assertEqual('{"style":"FontStyle.Normal","size":"20.00fp","weight":"300","fontFamily":"sans-serif"}');
done(); done();
}); });
...@@ -89,7 +88,7 @@ export default function textAreaJsunit() { ...@@ -89,7 +88,7 @@ export default function textAreaJsunit() {
let strJson = getInspectorByKey('textArea'); let strJson = getInspectorByKey('textArea');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info('textAreaJsunit_0300 component obj is: ' + obj.$attrs.placeholderFont); console.info('textAreaJsunit_0300 component obj is: ' + obj.$attrs.placeholderFont);
expect(obj.$attrs.placeholderFont).assertEqual('{"style":"FontStyle.Normal","size":"16.00fp","fontWeight":"FontWeight.Normal","fontFamily":"sans-serif"}'); expect(obj.$attrs.placeholderFont).assertEqual('{"style":"FontStyle.Normal","size":"-30.00fp","fontWeight":"FontWeight.Normal","fontFamily":"sans-serif"}');
done(); done();
}); });
...@@ -166,10 +165,10 @@ export default function textAreaJsunit() { ...@@ -166,10 +165,10 @@ export default function textAreaJsunit() {
let text = await driver.findComponent(BY.key('textArea')); let text = await driver.findComponent(BY.key('textArea'));
await text.inputText('123'); await text.inputText('123');
await CommonFunc.sleep(2000); await CommonFunc.sleep(2000);
let textIn = await driver.findComponent(BY.key('change')); let strJson = getInspectorByKey('change');
let txt = await textIn.getText(); let obj = JSON.parse(strJson);
console.info('textAreaJsunit_0800 component obj is: ' + txt); console.info('textAreaJsunit_0800 component obj is: ' + obj.$attrs.content);
expect(txt).assertEqual('test'); expect(obj.$attrs.content).assertEqual('123');
done(); done();
}); });
......
...@@ -43,56 +43,62 @@ export default function textTwoJsunit() { ...@@ -43,56 +43,62 @@ export default function textTwoJsunit() {
}); });
it('textTwoJsunit_0100', 0, async function (done) { it('textTwoJsunit_0100', 0, async function (done) {
console.info('imageOneJsunit_0100 START'); console.info('textTwoJsunit_0200 START');
// test the illegal value of decoration
await CommonFunc.sleep(1000);
globalThis.value.message.notify({name:'type',value:undefined})
await CommonFunc.sleep(1000);
globalThis.value.message.notify({name:'color',value:undefined})
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
// get the image component and test attribute
let strJson = getInspectorByKey('text1'); let strJson = getInspectorByKey('text1');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info('textTwoJsunit_0100 component obj is: ' + obj.$attrs.decoration); console.info('textTwoJsunit_0100 component obj is: ' + obj.$attrs.decoration);
expect(obj.$attrs.decoration).assertEqual('{"type":"TextDecorationType.None","color":"#FF000000"}'); expect(obj.$attrs.decoration).assertEqual('{"type":"TextDecorationType.None","color":"#FF000000"}');
done();
});
it('textTwoJsunit_0200', 0, async function (done) {
console.info('imageOneJsunit_0200 START');
await CommonFunc.sleep(500);
// get the image component and test attribute
let strJson = getInspectorByKey('text1');
let obj = JSON.parse(strJson);
console.info('textTwoJsunit_0200 component obj is: ' + obj.$attrs.decoration);
expect(obj.$attrs.decoration).assertEqual('{"type":"TextDecorationType.LineThrough","color":"#FFFFEEAF"}');
await CommonFunc.sleep(1000);
// to modify the atrribute // to modify the atrribute
globalThis.value.message.notify({name:'type',value:TextDecorationType.Overline}) globalThis.value.message.notify({name:'type',value:TextDecorationType.Overline})
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
globalThis.value.message.notify({name:'color',value:Color.Green}) globalThis.value.message.notify({name:'color',value:Color.Green})
await CommonFunc.sleep(2000); await CommonFunc.sleep(200);
let strJson2 = getInspectorByKey('text1'); let strJson2 = getInspectorByKey('text1');
let obj2 = JSON.parse(strJson2); let obj2 = JSON.parse(strJson2);
console.info('textTwoJsunit_0100 component obj2 is: ' + obj2.$attrs.decoration); console.info('textTwoJsunit_0200 component obj2 is: ' + obj2.$attrs.decoration);
expect(obj2.$attrs.decoration).assertEqual('{"type":"TextDecorationType.Overline","color":"#FF008000"}'); expect(obj2.$attrs.decoration).assertEqual('{"type":"TextDecorationType.Overline","color":"#FF008000"}');
await CommonFunc.sleep(1000);
globalThis.value.message.notify({name:'type',value:TextDecorationType.Underline}) globalThis.value.message.notify({name:'type',value:TextDecorationType.Underline})
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
globalThis.value.message.notify({name:'color',value:'rgb(238, 130, 238)'}) globalThis.value.message.notify({name:'color',value:'rgb(238, 130, 238)'})
await CommonFunc.sleep(2000); await CommonFunc.sleep(200);
let strJson3 = getInspectorByKey('text1'); let strJson3 = getInspectorByKey('text1');
let obj3 = JSON.parse(strJson3); let obj3 = JSON.parse(strJson3);
console.info('textTwoJsunit_0100 component obj3 is: ' + obj3.$attrs.decoration); console.info('textTwoJsunit_0200 component obj3 is: ' + obj3.$attrs.decoration);
expect(obj3.$attrs.decoration).assertEqual('{"type":"TextDecorationType.Underline","color":"#FFEE82EE"}'); expect(obj3.$attrs.decoration).assertEqual('{"type":"TextDecorationType.Underline","color":"#FFEE82EE"}');
await CommonFunc.sleep(1000);
globalThis.value.message.notify({name:'type',value:TextDecorationType.None}) globalThis.value.message.notify({name:'type',value:TextDecorationType.None})
await CommonFunc.sleep(1000); await CommonFunc.sleep(1000);
globalThis.value.message.notify({name:'color',value:'#FFACEEEE'}) globalThis.value.message.notify({name:'color',value:'#FFACEEEE'})
await CommonFunc.sleep(2000); await CommonFunc.sleep(200);
let strJson4 = getInspectorByKey('text1'); let strJson4 = getInspectorByKey('text1');
let obj4 = JSON.parse(strJson4); let obj4 = JSON.parse(strJson4);
console.info('textTwoJsunit_0100 component obj4 is: ' + obj4.$attrs.decoration); console.info('textTwoJsunit_0200 component obj4 is: ' + obj4.$attrs.decoration);
expect(obj4.$attrs.decoration).assertEqual('{"type":"TextDecorationType.None","color":"#FFACEEEE"}'); expect(obj4.$attrs.decoration).assertEqual('{"type":"TextDecorationType.None","color":"#FFACEEEE"}');
done(); done();
}); });
it('textTwoJsunit_0200', 0, async function (done) {
console.info('textTwoJsunit_0200 START');
// test the illegal value of decoration
await CommonFunc.sleep(1000);
globalThis.value.message.notify({name:'type',value:5})
await CommonFunc.sleep(1000);
globalThis.value.message.notify({name:'color',value:"#ACE"})
await CommonFunc.sleep(2000);
let strJson2 = getInspectorByKey('text1');
let obj2 = JSON.parse(strJson2);
console.info('textTwoJsunit_0200 component obj2 is: ' + obj2.$attrs.decoration);
expect(obj2.$attrs.decoration).assertEqual('{"type":"TextDecorationType.None","color":"#FFAACCEE"}');
});
it('textTwoJsunit_0300', 0, async function (done) { it('textTwoJsunit_0300', 0, async function (done) {
console.info('textTwoJsunit_0300 START'); console.info('textTwoJsunit_0300 START');
......
...@@ -81,7 +81,7 @@ export default function flex_AlignContent_SpaceBetween_TextOffsetTest() { ...@@ -81,7 +81,7 @@ export default function flex_AlignContent_SpaceBetween_TextOffsetTest() {
expect(fourthText.bottom).assertEqual(flexContainer.bottom); //行首贴边行尾溢出 expect(fourthText.bottom).assertEqual(flexContainer.bottom); //行首贴边行尾溢出
expect(Math.round(thirdText.top - secondText.bottom)).assertEqual(Math.round(fourthText.top - thirdText.bottom)); expect(Math.round(thirdText.top - secondText.bottom)).assertEqual(Math.round(fourthText.top - thirdText.bottom));
expect(Math.round(thirdText.top - secondText.bottom)).assertEqual(distanceBefore); expect(Math.round(thirdText.top - secondText.bottom)).assertEqual(Math.round(distanceBefore));
console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_1000] END');//其余组件行间距相等,未改变 console.info('[SUB_ACE_FLEXALIGNCONTENT_SPACEBETWEEN_1000] END');//其余组件行间距相等,未改变
done(); done();
}); });
......
...@@ -96,8 +96,8 @@ export default function flexTextMargin_AutoJsunit() { ...@@ -96,8 +96,8 @@ export default function flexTextMargin_AutoJsunit() {
let textMargin03 = CommonFunc.getComponentRect('textMargin03'); let textMargin03 = CommonFunc.getComponentRect('textMargin03');
let flexTextMargin01 = CommonFunc.getComponentRect('flexTextMargin01'); let flexTextMargin01 = CommonFunc.getComponentRect('flexTextMargin01');
expect(Math.round(textMargin01.left - flexTextMargin01.left)).assertEqual(Math.round(vp2px(500/17))) expect(Math.round(textMargin01.left - flexTextMargin01.left)).assertEqual(vp2px(30))
expect(Math.round(textMargin02.left - textMargin01.right)).assertEqual(Math.round(vp2px(500/17))) expect(Math.round(textMargin02.left - textMargin01.right)).assertEqual(vp2px(30))
expect(textMargin02.right).assertEqual(textMargin03.left) expect(textMargin02.right).assertEqual(textMargin03.left)
expect(textMargin03.right).assertEqual(flexTextMargin01.right) expect(textMargin03.right).assertEqual(flexTextMargin01.right)
...@@ -108,9 +108,9 @@ export default function flexTextMargin_AutoJsunit() { ...@@ -108,9 +108,9 @@ export default function flexTextMargin_AutoJsunit() {
expect(Math.round(textMargin01.bottom - textMargin01.top)).assertEqual(vp2px(50)) expect(Math.round(textMargin01.bottom - textMargin01.top)).assertEqual(vp2px(50))
expect(Math.round(textMargin02.bottom - textMargin02.top)).assertEqual(vp2px(100)) expect(Math.round(textMargin02.bottom - textMargin02.top)).assertEqual(vp2px(100))
expect(Math.round(textMargin03.bottom - textMargin03.top)).assertEqual(vp2px(150)) expect(Math.round(textMargin03.bottom - textMargin03.top)).assertEqual(vp2px(150))
expect(Math.round(textMargin01.right - textMargin01.left)).assertEqual(Math.round(vp2px(2500/17))) expect(Math.round(textMargin01.right - textMargin01.left)).assertEqual(Math.round(vp2px(440/3)))
expect(Math.round(textMargin02.right - textMargin02.left)).assertEqual(Math.round(vp2px(2500/17))) expect(Math.round(textMargin02.right - textMargin02.left)).assertEqual(Math.round(vp2px(440/3)))
expect(Math.round(textMargin03.right - textMargin03.left)).assertEqual(Math.round(vp2px(2500/17))) expect(Math.round(textMargin03.right - textMargin03.left)).assertEqual(Math.round(vp2px(440/3)))
expect(obj1.$attrs.constructor.direction).assertEqual('FlexDirection.Row') expect(obj1.$attrs.constructor.direction).assertEqual('FlexDirection.Row')
expect(obj1.$attrs.constructor.alignItems).assertEqual('ItemAlign.Auto') expect(obj1.$attrs.constructor.alignItems).assertEqual('ItemAlign.Auto')
console.info('new SUB_ACE_FLEXALIGNITEMS_AUTO_1500 END'); console.info('new SUB_ACE_FLEXALIGNITEMS_AUTO_1500 END');
......
...@@ -110,7 +110,7 @@ export default function AlignCenter_AddLayoutWeight() { ...@@ -110,7 +110,7 @@ export default function AlignCenter_AddLayoutWeight() {
expect(Center_AddLayoutWeight_013.right).assertEqual(Center_AddLayoutWeight_01.right); expect(Center_AddLayoutWeight_013.right).assertEqual(Center_AddLayoutWeight_01.right);
let oneWidth = Math.round(Center_AddLayoutWeight_011.right - Center_AddLayoutWeight_011.left); let oneWidth = Math.round(Center_AddLayoutWeight_011.right - Center_AddLayoutWeight_011.left);
let twoWidth = Math.round(Center_AddLayoutWeight_012.right - Center_AddLayoutWeight_012.left); let twoWidth = Math.round(Center_AddLayoutWeight_012.right - Center_AddLayoutWeight_012.left);
expect(twoWidth / oneWidth).assertEqual(2); expect(Math.round(twoWidth / oneWidth)).assertEqual(2);
expect(twoWidth + oneWidth).assertEqual(vp2px(350)); expect(twoWidth + oneWidth).assertEqual(vp2px(350));
expect(Math.round(Center_AddLayoutWeight_013.right - Center_AddLayoutWeight_013.left)).assertEqual(vp2px(150)); expect(Math.round(Center_AddLayoutWeight_013.right - Center_AddLayoutWeight_013.left)).assertEqual(vp2px(150));
expect(Math.round(Center_AddLayoutWeight_011.bottom - Center_AddLayoutWeight_011.top)).assertEqual(vp2px(50)); expect(Math.round(Center_AddLayoutWeight_011.bottom - Center_AddLayoutWeight_011.top)).assertEqual(vp2px(50));
......
...@@ -104,20 +104,20 @@ export default function AlignCenter_AddOneMargin() { ...@@ -104,20 +104,20 @@ export default function AlignCenter_AddOneMargin() {
expect(Center_AddOneMargin_01.top).assertEqual(Center_AddOneMargin_012.top); expect(Center_AddOneMargin_01.top).assertEqual(Center_AddOneMargin_012.top);
expect(Center_AddOneMargin_013.top).assertEqual(Center_AddOneMargin_012.top); expect(Center_AddOneMargin_013.top).assertEqual(Center_AddOneMargin_012.top);
expect(Math.round(Center_AddOneMargin_011.left - Center_AddOneMargin_01.left)) expect(Math.round(Center_AddOneMargin_011.left - Center_AddOneMargin_01.left))
.assertEqual(Math.round(vp2px(500/17))); .assertEqual(vp2px(30));
expect(Math.round(Center_AddOneMargin_011.top - Center_AddOneMargin_01.top)).assertEqual(vp2px(30)); expect(Math.round(Center_AddOneMargin_011.top - Center_AddOneMargin_01.top)).assertEqual(vp2px(30));
expect(Math.round(Center_AddOneMargin_012.left - Center_AddOneMargin_011.right)) expect(Math.round(Center_AddOneMargin_012.left - Center_AddOneMargin_011.right))
.assertEqual(Math.round(vp2px(500/17))); .assertEqual(vp2px(30));
expect(Center_AddOneMargin_012.right).assertEqual(Center_AddOneMargin_013.left); expect(Center_AddOneMargin_012.right).assertEqual(Center_AddOneMargin_013.left);
expect(Math.round(Center_AddOneMargin_011.bottom - Center_AddOneMargin_011.top)).assertEqual(vp2px(50)); expect(Math.round(Center_AddOneMargin_011.bottom - Center_AddOneMargin_011.top)).assertEqual(vp2px(50));
expect(Math.round(Center_AddOneMargin_012.bottom - Center_AddOneMargin_012.top)).assertEqual(vp2px(100)); expect(Math.round(Center_AddOneMargin_012.bottom - Center_AddOneMargin_012.top)).assertEqual(vp2px(100));
expect(Math.round(Center_AddOneMargin_013.bottom - Center_AddOneMargin_013.top)).assertEqual(vp2px(150)); expect(Math.round(Center_AddOneMargin_013.bottom - Center_AddOneMargin_013.top)).assertEqual(vp2px(150));
expect(Math.round(Center_AddOneMargin_011.right - Center_AddOneMargin_011.left)) expect(Math.round(Center_AddOneMargin_011.right - Center_AddOneMargin_011.left))
.assertEqual(Math.round(vp2px(2500/17))); .assertEqual(Math.round(vp2px(440/3)));
expect(Math.round(Center_AddOneMargin_012.right - Center_AddOneMargin_012.left)) expect(Math.round(Center_AddOneMargin_012.right - Center_AddOneMargin_012.left))
.assertEqual(Math.round(vp2px(2500/17))); .assertEqual(Math.round(vp2px(440/3)));
expect(Math.round(Center_AddOneMargin_013.right - Center_AddOneMargin_013.left)) expect(Math.round(Center_AddOneMargin_013.right - Center_AddOneMargin_013.left))
.assertEqual(Math.round(vp2px(2500/17))); .assertEqual(Math.round(vp2px(440/3)));
console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_CENTER_TEST_1500] END'); console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_CENTER_TEST_1500] END');
done(); done();
}) })
......
...@@ -110,7 +110,7 @@ export default function AlignEnd_AddLayoutWeight() { ...@@ -110,7 +110,7 @@ export default function AlignEnd_AddLayoutWeight() {
expect(End_AddLayoutWeight_013.right).assertEqual(End_AddLayoutWeight_01.right); expect(End_AddLayoutWeight_013.right).assertEqual(End_AddLayoutWeight_01.right);
let oneWidth = Math.round(End_AddLayoutWeight_011.right - End_AddLayoutWeight_011.left); let oneWidth = Math.round(End_AddLayoutWeight_011.right - End_AddLayoutWeight_011.left);
let twoWidth = Math.round(End_AddLayoutWeight_012.right - End_AddLayoutWeight_012.left); let twoWidth = Math.round(End_AddLayoutWeight_012.right - End_AddLayoutWeight_012.left);
expect(twoWidth / oneWidth).assertEqual(2); expect(Math.round(twoWidth / oneWidth)).assertEqual(2);
expect(twoWidth + oneWidth).assertEqual(vp2px(350)); expect(twoWidth + oneWidth).assertEqual(vp2px(350));
expect(Math.round(End_AddLayoutWeight_013.right - End_AddLayoutWeight_013.left)).assertEqual(vp2px(150)); expect(Math.round(End_AddLayoutWeight_013.right - End_AddLayoutWeight_013.left)).assertEqual(vp2px(150));
expect(Math.round(End_AddLayoutWeight_011.bottom - End_AddLayoutWeight_011.top)).assertEqual(vp2px(50)); expect(Math.round(End_AddLayoutWeight_011.bottom - End_AddLayoutWeight_011.top)).assertEqual(vp2px(50));
......
...@@ -100,8 +100,8 @@ export default function AlignEnd_AddOneMargin() { ...@@ -100,8 +100,8 @@ export default function AlignEnd_AddOneMargin() {
let End_AddOneMargin_013 = CommonFunc.getComponentRect('End_AddOneMargin_013'); let End_AddOneMargin_013 = CommonFunc.getComponentRect('End_AddOneMargin_013');
let End_AddOneMargin_01 = CommonFunc.getComponentRect('End_AddOneMargin_01'); let End_AddOneMargin_01 = CommonFunc.getComponentRect('End_AddOneMargin_01');
expect(Math.round(End_AddOneMargin_011.top - End_AddOneMargin_01.top)).assertEqual(vp2px(30)); expect(Math.round(End_AddOneMargin_011.top - End_AddOneMargin_01.top)).assertEqual(vp2px(30));
expect(Math.round(End_AddOneMargin_012.left - End_AddOneMargin_011.right)).assertEqual(Math.round(vp2px(500/17))); expect(Math.round(End_AddOneMargin_012.left - End_AddOneMargin_011.right)).assertEqual(vp2px(30));
expect(Math.round(End_AddOneMargin_011.left - End_AddOneMargin_01.left)).assertEqual(Math.round(vp2px(500/17))); expect(Math.round(End_AddOneMargin_011.left - End_AddOneMargin_01.left)).assertEqual(vp2px(30));
expect(End_AddOneMargin_013.top).assertEqual(End_AddOneMargin_012.top); expect(End_AddOneMargin_013.top).assertEqual(End_AddOneMargin_012.top);
expect(End_AddOneMargin_012.top).assertEqual(End_AddOneMargin_01.top); expect(End_AddOneMargin_012.top).assertEqual(End_AddOneMargin_01.top);
expect(End_AddOneMargin_013.left).assertEqual(End_AddOneMargin_012.right); expect(End_AddOneMargin_013.left).assertEqual(End_AddOneMargin_012.right);
...@@ -109,9 +109,9 @@ export default function AlignEnd_AddOneMargin() { ...@@ -109,9 +109,9 @@ export default function AlignEnd_AddOneMargin() {
expect(Math.round(End_AddOneMargin_011.bottom - End_AddOneMargin_011.top)).assertEqual(vp2px(50)); expect(Math.round(End_AddOneMargin_011.bottom - End_AddOneMargin_011.top)).assertEqual(vp2px(50));
expect(Math.round(End_AddOneMargin_012.bottom - End_AddOneMargin_012.top)).assertEqual(vp2px(100)); expect(Math.round(End_AddOneMargin_012.bottom - End_AddOneMargin_012.top)).assertEqual(vp2px(100));
expect(Math.round(End_AddOneMargin_013.bottom - End_AddOneMargin_013.top)).assertEqual(vp2px(150)); expect(Math.round(End_AddOneMargin_013.bottom - End_AddOneMargin_013.top)).assertEqual(vp2px(150));
expect(Math.round(End_AddOneMargin_011.right - End_AddOneMargin_011.left)).assertEqual(Math.round(vp2px(2500/17))); expect(Math.round(End_AddOneMargin_011.right - End_AddOneMargin_011.left)).assertEqual(Math.round(vp2px(440/3)));
expect(Math.round(End_AddOneMargin_012.right - End_AddOneMargin_012.left)).assertEqual(Math.round(vp2px(2500/17))); expect(Math.round(End_AddOneMargin_012.right - End_AddOneMargin_012.left)).assertEqual(Math.round(vp2px(440/3)));
expect(Math.round(End_AddOneMargin_013.right - End_AddOneMargin_013.left)).assertEqual(Math.round(vp2px(2500/17))); expect(Math.round(End_AddOneMargin_013.right - End_AddOneMargin_013.left)).assertEqual(Math.round(vp2px(440/3)));
console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_END_TEST_1500] END'); console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_END_TEST_1500] END');
done(); done();
}) })
......
...@@ -74,9 +74,9 @@ export default function AlignEnd_AddPadding() { ...@@ -74,9 +74,9 @@ export default function AlignEnd_AddPadding() {
expect(Math.round(End_AddPadding_011.bottom - End_AddPadding_011.top)).assertEqual(vp2px(50)); expect(Math.round(End_AddPadding_011.bottom - End_AddPadding_011.top)).assertEqual(vp2px(50));
expect(Math.round(End_AddPadding_012.bottom - End_AddPadding_012.top)).assertEqual(vp2px(100)); expect(Math.round(End_AddPadding_012.bottom - End_AddPadding_012.top)).assertEqual(vp2px(100));
expect(Math.round(End_AddPadding_013.bottom - End_AddPadding_013.top)).assertEqual(vp2px(150)); expect(Math.round(End_AddPadding_013.bottom - End_AddPadding_013.top)).assertEqual(vp2px(150));
expect(Math.round(End_AddPadding_011.right - End_AddPadding_011.left)).assertEqual(vp2px(440/3)); expect(Math.round(End_AddPadding_011.right - End_AddPadding_011.left)).assertEqual(Math.round(vp2px(440/3)));
expect(Math.round(End_AddPadding_012.right - End_AddPadding_012.left)).assertEqual(vp2px(440/3)); expect(Math.round(End_AddPadding_012.right - End_AddPadding_012.left)).assertEqual(Math.round(vp2px(440/3)));
expect(Math.round(End_AddPadding_013.right - End_AddPadding_013.left)).assertEqual(vp2px(440/3)); expect(Math.round(End_AddPadding_013.right - End_AddPadding_013.left)).assertEqual(Math.round(vp2px(440/3)));
console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_END_TEST_0300] END'); console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_END_TEST_0300] END');
done(); done();
}); });
......
...@@ -77,9 +77,9 @@ export default function AlignSpaceEvenly_AddAllSpace() { ...@@ -77,9 +77,9 @@ export default function AlignSpaceEvenly_AddAllSpace() {
expect(Math.round(SpaceEvenly_AddAllSpace_011.bottom - SpaceEvenly_AddAllSpace_011.top)).assertEqual(vp2px(50)); expect(Math.round(SpaceEvenly_AddAllSpace_011.bottom - SpaceEvenly_AddAllSpace_011.top)).assertEqual(vp2px(50));
expect(Math.round(SpaceEvenly_AddAllSpace_012.bottom - SpaceEvenly_AddAllSpace_012.top)).assertEqual(vp2px(100)); expect(Math.round(SpaceEvenly_AddAllSpace_012.bottom - SpaceEvenly_AddAllSpace_012.top)).assertEqual(vp2px(100));
expect(Math.round(SpaceEvenly_AddAllSpace_013.bottom - SpaceEvenly_AddAllSpace_013.top)).assertEqual(vp2px(150)); expect(Math.round(SpaceEvenly_AddAllSpace_013.bottom - SpaceEvenly_AddAllSpace_013.top)).assertEqual(vp2px(150));
expect(Math.round(SpaceEvenly_AddAllSpace_011.right - SpaceEvenly_AddAllSpace_011.left)).assertEqual(vp2px(440/3)); expect(Math.round(SpaceEvenly_AddAllSpace_011.right - SpaceEvenly_AddAllSpace_011.left)).assertEqual(Math.round(vp2px(440/3)));
expect(Math.round(SpaceEvenly_AddAllSpace_012.right - SpaceEvenly_AddAllSpace_012.left)).assertEqual(vp2px(440/3)); expect(Math.round(SpaceEvenly_AddAllSpace_012.right - SpaceEvenly_AddAllSpace_012.left)).assertEqual(Math.round(vp2px(440/3)));
expect(Math.round(SpaceEvenly_AddAllSpace_013.right - SpaceEvenly_AddAllSpace_013.left)).assertEqual(vp2px(440/3)); expect(Math.round(SpaceEvenly_AddAllSpace_013.right - SpaceEvenly_AddAllSpace_013.left)).assertEqual(Math.round(vp2px(440/3)));
console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_0600] END'); console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_0600] END');
done(); done();
}); });
......
...@@ -122,7 +122,7 @@ export default function AlignSpaceEvenly_AddLayoutWeight() { ...@@ -122,7 +122,7 @@ export default function AlignSpaceEvenly_AddLayoutWeight() {
.assertEqual(vp2px(150)); .assertEqual(vp2px(150));
let oneWidth = Math.round(SpaceEvenly_AddLayoutWeight_011.right - SpaceEvenly_AddLayoutWeight_011.left); let oneWidth = Math.round(SpaceEvenly_AddLayoutWeight_011.right - SpaceEvenly_AddLayoutWeight_011.left);
let twoWidth = Math.round(SpaceEvenly_AddLayoutWeight_012.right - SpaceEvenly_AddLayoutWeight_012.left); let twoWidth = Math.round(SpaceEvenly_AddLayoutWeight_012.right - SpaceEvenly_AddLayoutWeight_012.left);
expect(twoWidth / oneWidth).assertEqual(2); expect(Math.round(twoWidth / oneWidth)).assertEqual(2);
expect(twoWidth + oneWidth).assertEqual(vp2px(350)); expect(twoWidth + oneWidth).assertEqual(vp2px(350));
expect(Math.round(SpaceEvenly_AddLayoutWeight_013.right - SpaceEvenly_AddLayoutWeight_013.left)). expect(Math.round(SpaceEvenly_AddLayoutWeight_013.right - SpaceEvenly_AddLayoutWeight_013.left)).
assertEqual(vp2px(150)); assertEqual(vp2px(150));
......
...@@ -105,7 +105,7 @@ export default function AlignSpaceEvenly_AddOneMargin() { ...@@ -105,7 +105,7 @@ export default function AlignSpaceEvenly_AddOneMargin() {
let SpaceEvenly_AddOneMargin_01 = CommonFunc.getComponentRect('SpaceEvenly_AddOneMargin_01'); let SpaceEvenly_AddOneMargin_01 = CommonFunc.getComponentRect('SpaceEvenly_AddOneMargin_01');
expect(Math.round(SpaceEvenly_AddOneMargin_011.top - SpaceEvenly_AddOneMargin_01.top)).assertEqual(vp2px(30)); expect(Math.round(SpaceEvenly_AddOneMargin_011.top - SpaceEvenly_AddOneMargin_01.top)).assertEqual(vp2px(30));
expect(Math.round(SpaceEvenly_AddOneMargin_011.left - SpaceEvenly_AddOneMargin_01.left)) expect(Math.round(SpaceEvenly_AddOneMargin_011.left - SpaceEvenly_AddOneMargin_01.left))
.assertEqual(Math.round(vp2px(500/17))); .assertEqual(vp2px(30));
expect(Math.round(SpaceEvenly_AddOneMargin_012.left - SpaceEvenly_AddOneMargin_011.right)) expect(Math.round(SpaceEvenly_AddOneMargin_012.left - SpaceEvenly_AddOneMargin_011.right))
.assertEqual(Math.round(SpaceEvenly_AddOneMargin_011.left - SpaceEvenly_AddOneMargin_01.left)); .assertEqual(Math.round(SpaceEvenly_AddOneMargin_011.left - SpaceEvenly_AddOneMargin_01.left));
expect(SpaceEvenly_AddOneMargin_013.right).assertEqual(SpaceEvenly_AddOneMargin_01.right); expect(SpaceEvenly_AddOneMargin_013.right).assertEqual(SpaceEvenly_AddOneMargin_01.right);
...@@ -116,11 +116,11 @@ export default function AlignSpaceEvenly_AddOneMargin() { ...@@ -116,11 +116,11 @@ export default function AlignSpaceEvenly_AddOneMargin() {
expect(Math.round(SpaceEvenly_AddOneMargin_012.bottom - SpaceEvenly_AddOneMargin_012.top)).assertEqual(vp2px(100)); expect(Math.round(SpaceEvenly_AddOneMargin_012.bottom - SpaceEvenly_AddOneMargin_012.top)).assertEqual(vp2px(100));
expect(Math.round(SpaceEvenly_AddOneMargin_013.bottom - SpaceEvenly_AddOneMargin_013.top)).assertEqual(vp2px(150)); expect(Math.round(SpaceEvenly_AddOneMargin_013.bottom - SpaceEvenly_AddOneMargin_013.top)).assertEqual(vp2px(150));
expect(Math.round(SpaceEvenly_AddOneMargin_011.right - SpaceEvenly_AddOneMargin_011.left)) expect(Math.round(SpaceEvenly_AddOneMargin_011.right - SpaceEvenly_AddOneMargin_011.left))
.assertEqual(Math.round(vp2px(2500/17))); .assertEqual(Math.round(vp2px(440/3)));
expect(Math.round(SpaceEvenly_AddOneMargin_012.right - SpaceEvenly_AddOneMargin_012.left)) expect(Math.round(SpaceEvenly_AddOneMargin_012.right - SpaceEvenly_AddOneMargin_012.left))
.assertEqual(Math.round(vp2px(2500/17))); .assertEqual(Math.round(vp2px(440/3)));
expect(Math.round(SpaceEvenly_AddOneMargin_013.right - SpaceEvenly_AddOneMargin_013.left)) expect(Math.round(SpaceEvenly_AddOneMargin_013.right - SpaceEvenly_AddOneMargin_013.left))
.assertEqual(Math.round(vp2px(2500/17))); .assertEqual(Math.round(vp2px(440/3)));
console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_1600] END'); console.info('[SUB_ACE_FLEX_JUSTIFYCONTENT_FLEXALIGN_SPACEEVENLY_TEST_1600] END');
done(); done();
}) })
......
...@@ -110,7 +110,7 @@ export default function AlignStart_AddLayoutWeight() { ...@@ -110,7 +110,7 @@ export default function AlignStart_AddLayoutWeight() {
expect(Start_AddLayoutWeight_013.right).assertEqual(Start_AddLayoutWeight_01.right); expect(Start_AddLayoutWeight_013.right).assertEqual(Start_AddLayoutWeight_01.right);
let oneWidth = Math.round(Start_AddLayoutWeight_011.right - Start_AddLayoutWeight_011.left); let oneWidth = Math.round(Start_AddLayoutWeight_011.right - Start_AddLayoutWeight_011.left);
let twoWidth = Math.round(Start_AddLayoutWeight_012.right - Start_AddLayoutWeight_012.left); let twoWidth = Math.round(Start_AddLayoutWeight_012.right - Start_AddLayoutWeight_012.left);
expect(twoWidth / oneWidth).assertEqual(2); expect(Math.round(twoWidth / oneWidth)).assertEqual(2);
expect(twoWidth + oneWidth).assertEqual(vp2px(350)); expect(twoWidth + oneWidth).assertEqual(vp2px(350));
expect(Math.round(Start_AddLayoutWeight_013.right - Start_AddLayoutWeight_013.left)).assertEqual(vp2px(150)); expect(Math.round(Start_AddLayoutWeight_013.right - Start_AddLayoutWeight_013.left)).assertEqual(vp2px(150));
expect(Math.round(Start_AddLayoutWeight_011.bottom - Start_AddLayoutWeight_011.top)).assertEqual(vp2px(50)); expect(Math.round(Start_AddLayoutWeight_011.bottom - Start_AddLayoutWeight_011.top)).assertEqual(vp2px(50));
......
...@@ -104,16 +104,16 @@ export default function AlignStart_AddOneMargin() { ...@@ -104,16 +104,16 @@ export default function AlignStart_AddOneMargin() {
expect(Start_AddOneMargin_013.left).assertEqual(Start_AddOneMargin_012.right); expect(Start_AddOneMargin_013.left).assertEqual(Start_AddOneMargin_012.right);
expect(Start_AddOneMargin_013.right).assertEqual(Start_AddOneMargin_01.right); expect(Start_AddOneMargin_013.right).assertEqual(Start_AddOneMargin_01.right);
expect(Math.round(Start_AddOneMargin_012.left - Start_AddOneMargin_011.right)) expect(Math.round(Start_AddOneMargin_012.left - Start_AddOneMargin_011.right))
.assertEqual(Math.round(vp2px(500/17))); .assertEqual(vp2px(30));
expect(Math.round(Start_AddOneMargin_011.top - Start_AddOneMargin_01.top)).assertEqual(vp2px(30)); expect(Math.round(Start_AddOneMargin_011.top - Start_AddOneMargin_01.top)).assertEqual(vp2px(30));
expect(Math.round(Start_AddOneMargin_011.left - Start_AddOneMargin_01.left)) expect(Math.round(Start_AddOneMargin_011.left - Start_AddOneMargin_01.left))
.assertEqual(Math.round(vp2px(500/17))); .assertEqual(vp2px(30));
expect(Math.round(Start_AddOneMargin_011.right - Start_AddOneMargin_011.left)) expect(Math.round(Start_AddOneMargin_011.right - Start_AddOneMargin_011.left))
.assertEqual(Math.round(vp2px(2500/17))); .assertEqual(Math.round(vp2px(440/3)));
expect(Math.round(Start_AddOneMargin_012.right - Start_AddOneMargin_012.left)) expect(Math.round(Start_AddOneMargin_012.right - Start_AddOneMargin_012.left))
.assertEqual(Math.round(vp2px(2500/17))); .assertEqual(Math.round(vp2px(440/3)));
expect(Math.round(Start_AddOneMargin_013.right - Start_AddOneMargin_013.left)) expect(Math.round(Start_AddOneMargin_013.right - Start_AddOneMargin_013.left))
.assertEqual(Math.round(vp2px(2500/17))); .assertEqual(Math.round(vp2px(440/3)));
expect(Math.round(Start_AddOneMargin_011.bottom - Start_AddOneMargin_011.top)).assertEqual(vp2px(50)); expect(Math.round(Start_AddOneMargin_011.bottom - Start_AddOneMargin_011.top)).assertEqual(vp2px(50));
expect(Math.round(Start_AddOneMargin_012.bottom - Start_AddOneMargin_012.top)).assertEqual(vp2px(100)); expect(Math.round(Start_AddOneMargin_012.bottom - Start_AddOneMargin_012.top)).assertEqual(vp2px(100));
expect(Math.round(Start_AddOneMargin_013.bottom - Start_AddOneMargin_013.top)).assertEqual(vp2px(150)); expect(Math.round(Start_AddOneMargin_013.bottom - Start_AddOneMargin_013.top)).assertEqual(vp2px(150));
......
{
"app": {
"bundleName": "com.open.harmony.acewebfourtest",
"vendor": "huawei",
"versionCode": 1000000,
"versionName": "1.0.0",
"debug": false,
"icon": "$media:icon",
"label": "$string:app_name",
"description": "$string:description_application",
"distributedNotificationEnabled": true,
"keepAlive": true,
"singleUser": true,
"minAPIVersion": 10,
"targetAPIVersion": 10,
"car": {
"apiCompatibleVersion": 10,
"singleUser": false
}
}
}
\ No newline at end of file
{
"string":[
{
"name":"app_name",
"value":"ohosProject"
}
]
}
\ No newline at end of file
# Copyright (c) 2022 Huawei Device Co., Ltd. # Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
...@@ -13,28 +13,29 @@ ...@@ -13,28 +13,29 @@
import("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
ohos_hap_assist_suite("ActsServiceAbilityServerRelyHap") { ohos_js_hap_suite("ActsAceWebDevFourTest") {
hap_name = "ActsServiceAbilityServerRelyHap" hap_profile = "entry/src/main/module.json"
js_build_mode = "debug" js_build_mode = "debug"
hap_profile = "entry/src/main/config.json"
testonly = true
deps = [ deps = [
":serviceability_resources", ":ace_ets_web_dev_js_assets",
":serviceability_ts_assets", ":ace_ets_web_dev_resources",
] ]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b" certificate_profile = "signature/openharmony_sx.p7b"
subsystem_name = "ability" hap_name = "ActsAceWebDevFourTest"
part_name = "ability_runtime"
} }
ohos_js_assets("serviceability_ts_assets") { ohos_app_scope("ace_ets_web_dev_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("ace_ets_web_dev_js_assets") {
source_dir = "entry/src/main/ets" source_dir = "entry/src/main/ets"
hap_profile = "entry/src/main/config.json"
ets2abc = true
} }
ohos_resources("serviceability_resources") { ohos_resources("ace_ets_web_dev_resources") {
sources = [ "entry/src/main/resources" ] sources = [ "entry/src/main/resources" ]
hap_profile = "entry/src/main/config.json" deps = [ ":ace_ets_web_dev_app_profile" ]
hap_profile = "entry/src/main/module.json"
} }
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "OHJSUnitTest",
"test-timeout": "180000",
"bundle-name": "com.open.harmony.acewebfourtest",
"module-name": "phone",
"shell-timeout": "600000",
"testcase-timeout": 70000
},
"kits": [{
"test-file-name": [
"ActsAceWebDevFourTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "ShellKit",
"run-command": [
"power-shell wakeup",
"power-shell setmode 602"
]
}
]
}
\ No newline at end of file
import AbilityStage from "@ohos.app.ability.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
globalThis.stageOnCreateRun = 1;
globalThis.stageContext = this.context;
}
}
import Ability from '@ohos.app.ability.UIAbility'
export default class MainAbility extends Ability {
onCreate(want,launchParam){
// Ability is creating, initialize resources for this ability
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
}
onDestroy() {
// Ability is destroying, release resources for this ability
console.log("[Demo] MainAbility onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate windowStage="+ windowStage)
globalThis.windowStage = windowStage
globalThis.abilityContext = this.context
windowStage.setUIContent(this.context, "MainAbility/pages/web", null)
}
onWindowStageDestroy() {
//Main window is destroyed, release UI related resources
console.log("[Demo] MainAbility onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("[Demo] MainAbility onForeground")
}
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility onBackground")
}
};
/*
* Copyright (c) 2021~2023 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 events_emitter from '@ohos.events.emitter';
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
import { Hypium } from '@ohos/hypium';
import testsuite from '../../test/List.test';
import Utils from '../../test/Utils';
import web_webview from '@ohos.web.webview';
import fileio from '@ohos.fileio';
import prompt from '@system.prompt';
let loadedUrl;
@Entry
@Component
struct Index {
controller: web_webview.WebviewController = new web_webview.WebviewController();
@State outputStr: string = ''
@State playing: boolean = false
@State str:string="emitOnLoadIntercept"
onPageShow(){
let valueChangeEvent={
eventId:10,
priority:events_emitter.EventPriority.LOW
};
events_emitter.on(valueChangeEvent,this.valueChangeCallBack);
}
private valueChangeCallBack=(eventData)=>{
console.info("web page valueChangeCallBack");
if(eventData != null){
console.info("valueChangeCallBack:"+ JSON.stringify(eventData));
if(eventData.data.ACTION != null){
this.str = eventData.data.ACTION;
}
}
}
aboutToAppear(){
let abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
let abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}
build(){
Column(){
Row(){
Button("web click").key('webcomponent').onClick(async ()=>{
console.info("key==>"+this.str)
switch(this.str){
case "emitOnLoadIntercept":{
this.controller.loadUrl("https://www.baidu.com/")
break;
}
default:
console.info("can not match case")
}
})
}
Web({src:"www.example.com",controller:this.controller})
.onLoadIntercept((event) => {
console.log('url:' + event.data.getRequestUrl())
Utils.emitEvent(event.data.getRequestUrl(),2)
console.log('isMainFrame:' + event.data.isMainFrame())
console.log('isRedirect:' + event.data.isRedirect())
console.log('isRequestGesture:' + event.data.isRequestGesture())
return false
})
.onErrorReceive((event) => {
console.log('getErrorInfo:' + event.error.getErrorInfo())
Utils.emitEvent(event.error.getErrorInfo(),3)
})
}
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import events_emitter from '@ohos.events.emitter';
import Utils from '../../test/Utils';
import web_webview from '@ohos.web.webview';
function Uint8ArrayToString(dataArray) {
var dataString = ''
for (var i = 0; i < dataArray.length; i++) {
dataString += String.fromCharCode(dataArray[i])
}
return dataString
}
function ParseX509CertInfo(x509CertArray) {
let res: string = 'getCertificate success: len = ' + x509CertArray.length;
for (let i = 0; i < x509CertArray.length; i++) {
res += ', index = ' + i + ', issuer name = '
+ Uint8ArrayToString(x509CertArray[i].getIssuerName().data) + ', subject name = '
+ Uint8ArrayToString(x509CertArray[i].getSubjectName().data) + ', valid start = '
+ x509CertArray[i].getNotBeforeTime()
+ ', valid end = ' + x509CertArray[i].getNotAfterTime()
}
return res
}
@Entry
@Component
struct Second {
@State outputStr: string = ''
webviewCtl: web_webview.WebviewController = new web_webview.WebviewController();
@State str:string="emitGetCertificate"
onPageShow(){
let valueChangeEvent={
eventId:10,
priority:events_emitter.EventPriority.LOW
};
events_emitter.on(valueChangeEvent,this.valueChangeCallBack);
}
private valueChangeCallBack=(eventData)=>{
console.info("web page valueChangeCallBack");
if(eventData != null){
console.info("valueChangeCallBack:"+ JSON.stringify(eventData));
if(eventData.data.ACTION != null){
this.str = eventData.data.ACTION;
}
}
}
build(){
Column(){
Row(){
Button("web click").key('webcomponenttwo').onClick(async ()=>{
console.info("key==>"+this.str);
switch(this.str){
case "emitGetCertificate":{
this.webviewCtl.loadUrl('https://www.baidu.com')
try {
this.webviewCtl.getCertificate().then(x509CertArray => {
this.outputStr = ParseX509CertInfo(x509CertArray);
console.info('11111111111111'+this.outputStr)
Utils.emitEvent(this.outputStr,4)
})
} catch (error) {
this.outputStr = 'getCertificate failed: ' + error.code + ", errMsg: " + error.message;
}
break;
}
default:
console.info("can not match case");
}
})
}
Web({ src: 'https://www.example.com', controller: this.webviewCtl })
.fileAccess(true)
.javaScriptAccess(true)
.domStorageAccess(true)
.onlineImageAccess(true)
.onPageEnd((e) => {
this.outputStr = 'onPageEnd : url = ' + e.url
})
}
}
}
\ No newline at end of file
/*
* 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 it',
'-s level', '-s testType', '-s size', '-s timeout',
'-s dryRun'
])
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams = `${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 ")
}
async onRun() {
console.log('OpenHarmonyTestRunner onRun run')
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility'
let lMonitor = {
abilityName: testAbilityName,
onAbilityCreate: onAbilityCreateCallback,
};
abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback)
var cmd = 'aa start -d 0 -a com.example.myapplication.MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters)
var debug = abilityDelegatorArguments.parameters["-D"]
if (debug == 'true')
{
cmd += ' -D'
}
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 end')
}
};
\ No newline at end of file
/* /*
* Copyright (C) 2022 Huawei Device Co., Ltd. * Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import AbilityStage from "@ohos.app.ability.AbilityStage" import webJsunit from './WebJsunit.test'
import webTwoJsunit from './WebTwoJsunit.test'
export default class MyAbilityStage extends AbilityStage { export default function testsuite() {
onCreate() { webJsunit()
console.log("MyAbilityStage onCreate"); webTwoJsunit()
}
} }
\ No newline at end of file
/*
* 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 events_emitter from '@ohos.events.emitter';
import { expect } from "@ohos/hypium";
export default class Utils {
static sleep(time){
return new Promise((resolve,reject)=>{
setTimeout(()=>{
resolve("ok")
},time)
}).then(()=>{
console.info(`sleep ${time} over...`)
})
}
static registerEvent(testCaseName,expectedValue,eventId,done){
console.info(`[${testCaseName}] START`);
try{
let callBack=(backData)=>{
try{
console.info(`${testCaseName} get result is:`+JSON.stringify(backData));
expect(backData.data.ACTION).assertEqual(expectedValue);
console.info(`[${testCaseName}] END`);
}catch(err){
console.info(`[${testCaseName}] err:`+JSON.stringify(err));
}
done()
}
let innerEvent = {
eventId:eventId,
priority:events_emitter.EventPriority.LOW
}
events_emitter.on(innerEvent,callBack)
}catch(err){
console.info(`[${testCaseName}] err:`+JSON.stringify(err));
}
}
static emitEvent(actualValue,eventId){
try {
let backData = {
data: {
"ACTION": actualValue
}
}
let backEvent = {
eventId:eventId,
priority:events_emitter.EventPriority.LOW
}
console.info("webFlag start to emit action state");
events_emitter.emit(backEvent, backData);
} catch (err) {
console.info("webFlag emit action state err: " + JSON.stringify(err));
}
}
static registerEventTwo(testCaseName,eventId,done){
console.info(`[${testCaseName}] START`);
try{
let callBack=(backData)=>{
try{
console.info(`${testCaseName} get result is:`+JSON.stringify(backData));
expect(backData.data.actualValue).assertLarger(backData.data.expectedValue-100);
expect(backData.data.actualValue).assertLess(backData.data.expectedValue-(-100));
console.info(`[${testCaseName}] END`);
}catch(err){
console.info(`[${testCaseName}] err:`+JSON.stringify(err));
}
done()
}
let innerEvent = {
eventId:eventId,
priority:events_emitter.EventPriority.LOW
}
events_emitter.on(innerEvent,callBack)
}catch(err){
console.info(`[${testCaseName}] err:`+JSON.stringify(err));
}
}
static emitEventTwo(expectedValue,actualValue,eventId){
try {
let backData = {
data: {
"expectedValue":expectedValue,
"actualValue":actualValue
}
}
let backEvent = {
eventId:eventId,
priority:events_emitter.EventPriority.LOW
}
console.info("webFlag start to emit action state");
events_emitter.emit(backEvent, backData);
} catch (err) {
console.info("webFlag emit action state err: " + JSON.stringify(err));
}
}
static registerContainEvent(testCaseName,expectedValue,eventId,done){
console.info(`[${testCaseName}] START`);
try{
let callBack=(backData)=>{
try{
console.info(`${testCaseName} get result is:`+JSON.stringify(backData));
expect(backData.data.ACTION).assertContain(expectedValue);
console.info(`[${testCaseName}] END`);
}catch(err){
console.info(`[${testCaseName}] err:`+JSON.stringify(err));
}
done()
}
let innerEvent = {
eventId:eventId,
priority:events_emitter.EventPriority.LOW
}
events_emitter.on(innerEvent,callBack)
}catch(err){
console.info(`[${testCaseName}] err:`+JSON.stringify(err));
}
}
static commitKey(emitKey){
try {
let backData = {
data: {
"ACTION": emitKey
}
}
let backEvent = {
eventId:10,
priority:events_emitter.EventPriority.LOW
}
console.info("start send emitKey");
events_emitter.emit(backEvent, backData);
} catch (err) {
console.info("emit emitKey err: " + JSON.stringify(err));
}
}
static registerLargerEvent(testCaseName,eventId,done){
console.info(`[${testCaseName}] START`);
try{
let callBack=(backData)=>{
try{
console.info(`${testCaseName} get result is:`+JSON.stringify(backData));
expect(backData.data.actualValue).assertLarger(backData.data.expectedValue);
console.info(`[${testCaseName}] END`);
}catch(err){
console.info(`[${testCaseName}] err:`+JSON.stringify(err));
}
done()
}
let innerEvent = {
eventId:eventId,
priority:events_emitter.EventPriority.LOW
}
events_emitter.on(innerEvent,callBack)
}catch(err){
console.info(`[${testCaseName}] err:`+JSON.stringify(err));
}
}
}
\ No newline at end of file
/*
* 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.
*/
// @ts-nocheck
import { describe, beforeEach, afterEach, it, expect } from "@ohos/hypium";
import events_emitter from '@ohos.events.emitter';
import Utils from './Utils.ets';
let emitKey = "emitOnLoadIntercept";
export default function webJsunit() {
describe('ActsAceWebDevTest', function () {
beforeEach(async function (done) {
await Utils.sleep(2000);
console.info("web beforeEach start");
done();
})
afterEach(async function (done) {
console.info("web afterEach start:"+emitKey);
try {
let backData = {
data: {
"ACTION": emitKey
}
}
let backEvent = {
eventId:10,
priority:events_emitter.EventPriority.LOW
}
console.info("start send emitKey");
events_emitter.emit(backEvent, backData);
} catch (err) {
console.info("emit emitKey err: " + JSON.stringify(err));
}
await Utils.sleep(2000);
done();
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_002
*tc.name OnLoadIntercept *tc.desic Injects the JavaScript object into window and invoke the function in window
*/
it('OnLoadIntercept',0,async function(done){
emitKey="emitOnLoadIntercept";
Utils.registerEvent("OnLoadIntercept","https://www.baidu.com/",2,done);
sendEventByKey('webcomponent',10,'');
})
})
}
/*
* 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.
*/
// @ts-nocheck
import { describe, beforeEach, afterEach, it, expect, beforeAll} from "@ohos/hypium";
import events_emitter from '@ohos.events.emitter';
import router from '@system.router';
import Utils from './Utils.ets';
let emitKey = "emitGetCertificate";
export default function webTwoJsunit() {
describe('overviewTest', function () {
beforeAll(async function (done) {
let options = {
uri: 'MainAbility/pages/webTwo',
}
try {
router.clear();
let pages = router.getState();
console.info("get webTwo state success " + JSON.stringify(pages));
if (!("webTwo" == pages.name)) {
console.info("get webTwo state success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push webTwo page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push webTwo page error: " + err);
}
done()
});
beforeEach(async function (done) {
await Utils.sleep(2000);
console.info("web beforeEach start");
done();
})
afterEach(async function (done) {
console.info("web afterEach start:"+emitKey);
try {
let backData = {
data: {
"ACTION": emitKey
}
}
let backEvent = {
eventId:10,
priority:events_emitter.EventPriority.LOW
}
console.info("start send emitKey");
events_emitter.emit(backEvent, backData);
} catch (err) {
console.info("emit emitKey err: " + JSON.stringify(err));
}
await Utils.sleep(2000);
done();
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_001
*tc.name GetCertificate
*tc.desic Sets allow the Web access overview mode
*/
it('GetCertificate',0,async function(done){
emitKey="emitOverviewModeAccessFalse";
Utils.registerEvent("GetCertificate","getCertificate success: len = 0",4,done);
sendEventByKey('webcomponenttwo',10,'');
})
})
}
\ No newline at end of file
{
"module": {
"name": "phone",
"type": "entry",
"srcEntrance": "./ets/Application/AbilityStage.ts",
"description": "$string:phone_entry_dsc",
"mainElement": "MainAbility",
"deviceTypes": [
"tablet",
"default",
"phone"
],
"deliveryWithInstall": true,
"installationFree": false,
"uiSyntax": "ets",
"pages": "$profile:main_pages",
"metadata": [
{
"name": "ArkTSPartialUpdate",
"value": "false"
}
],
"abilities": [{
"name": "com.example.myapplication.MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"description": "$string:phone_entry_main",
"icon": "$media:icon",
"label": "$string:entry_label",
"visible": true,
"orientation": "portrait",
"skills": [{
"actions": [
"action.system.home"
],
"entities": [
"entity.system.home"
]
}]
}],
"requestPermissions": [
{
"name": "ohos.permission.LOCATION"
},
{
"name": "ohos.permission.INTERNET"
}
]
}
}
\ No newline at end of file
{
"string": [
{
"name": "phone_entry_dsc",
"value": "i am an entry for phone"
},
{
"name": "phone_entry_main",
"value": "the phone entry ability"
},
{
"name": "entry_label",
"value": "ActsContextTest"
},
{
"name": "form_description",
"value": "my form"
},
{
"name": "serviceability_description",
"value": "my whether"
},
{
"name": "description_application",
"value": "demo for test"
},
{
"name": "app_name",
"value": "Demo"
}
]
}
{
"src": [
"MainAbility/pages/web",
"MainAbility/pages/webTwo"
]
}
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>music</title>
</head>
<body>
<audio src="../base/media/gequ.mp3" loop="loop" controls="controls" autoplay="autoplay"></audio>
</body>
</html>
...@@ -403,7 +403,7 @@ napi_value PluginRender::NapiChangeColor(napi_env env, napi_callback_info info) ...@@ -403,7 +403,7 @@ napi_value PluginRender::NapiChangeColor(napi_env env, napi_callback_info info)
napi_value PluginRender::TestGetXComponentId(napi_env env, napi_callback_info info) napi_value PluginRender::TestGetXComponentId(napi_env env, napi_callback_info info)
{ {
napi_value thisArg; napi_value thisArg;
napi_status status; [[maybe_unused]] napi_status status;
napi_value exportInstance; napi_value exportInstance;
OH_NativeXComponent *nativeXComponent = nullptr; OH_NativeXComponent *nativeXComponent = nullptr;
...@@ -413,7 +413,15 @@ napi_value PluginRender::TestGetXComponentId(napi_env env, napi_callback_info in ...@@ -413,7 +413,15 @@ napi_value PluginRender::TestGetXComponentId(napi_env env, napi_callback_info in
NAPI_CALL(env, napi_get_cb_info(env, info, NULL, NULL, &thisArg, NULL)); NAPI_CALL(env, napi_get_cb_info(env, info, NULL, NULL, &thisArg, NULL));
status = napi_get_named_property(env, thisArg, OH_NATIVE_XCOMPONENT_OBJ, &exportInstance); status = napi_get_named_property(env, thisArg, OH_NATIVE_XCOMPONENT_OBJ, &exportInstance);
if (status != napi_ok) {
return nullptr;
};
status = napi_unwrap(env, exportInstance, reinterpret_cast<void**>(&nativeXComponent)); status = napi_unwrap(env, exportInstance, reinterpret_cast<void**>(&nativeXComponent));
if (status != napi_ok) {
return nullptr;
};
ret = OH_NativeXComponent_GetXComponentId(nativeXComponent, idStr, &idSize); ret = OH_NativeXComponent_GetXComponentId(nativeXComponent, idStr, &idSize);
if (ret != OH_NATIVEXCOMPONENT_RESULT_SUCCESS) { if (ret != OH_NATIVEXCOMPONENT_RESULT_SUCCESS) {
return nullptr; return nullptr;
...@@ -570,4 +578,4 @@ napi_value PluginRender::TestGetXComponent_RegisterMouseEventCallback(napi_env e ...@@ -570,4 +578,4 @@ napi_value PluginRender::TestGetXComponent_RegisterMouseEventCallback(napi_env e
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
\ No newline at end of file
...@@ -925,6 +925,35 @@ describe('ActsAbilityTest', function () { ...@@ -925,6 +925,35 @@ describe('ActsAbilityTest', function () {
done(); done();
}) })
it('TaskPoolTestClass062', 0, async function (done) {
async function func(value1, value2) {
"use concurrent"
let result = await new Promise((resolve, reject) => {
let value = value1 + value2;
resolve(value);
})
return result;
}
var result = await taskpool.execute(func, 10, 20);
expect(result).assertEqual(30);
done();
})
it('TaskPoolTestClass063', 0, async function (done) {
async function func(value1, value2) {
"use concurrent"
let result = await new Promise((resolve, reject) => {
let value = value1 + value2;
resolve(value);
})
return result;
}
var task = new taskpool.Task(func, 10, 20);
var result = await taskpool.execute(task);
expect(result).assertEqual(30);
done();
})
/** /**
* @tc.number : TaskPoolTestClass049 * @tc.number : TaskPoolTestClass049
* @tc.name : Async Function Cancel task * @tc.name : Async Function Cancel task
......
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
"rm -rf /data/local/tmp/libc-test/dlns_dlsym_test", "rm -rf /data/local/tmp/libc-test/dlns_dlsym_test",
"rm -rf /data/local/tmp/libc-test/dlns_special_scene_test", "rm -rf /data/local/tmp/libc-test/dlns_special_scene_test",
"rm -rf /data/local/tmp/libc-test/dlns_separated_test", "rm -rf /data/local/tmp/libc-test/dlns_separated_test",
"rm -rf /data/local/tmp/libc-test/dlns_dlopen_ext_test",
"rm -rf /data/local/tmp/libc-test/dlopen_ext_relro_test", "rm -rf /data/local/tmp/libc-test/dlopen_ext_relro_test",
"rm -rf /data/local/tmp/libc-test/trace_stresstest", "rm -rf /data/local/tmp/libc-test/trace_stresstest",
"rm -rf /data/local/tmp/libc-test/ldso_randomization_test", "rm -rf /data/local/tmp/libc-test/ldso_randomization_test",
......
...@@ -217,18 +217,18 @@ describe('bluetoothBLETest', function() { ...@@ -217,18 +217,18 @@ describe('bluetoothBLETest', function() {
await sleep(5000) await sleep(5000)
try { try {
await gattClient.getDeviceName().then((data) => { await gattClient.getDeviceName().then((data) => {
console.info('[bluetooth_js] device name' + JSON.stringify(data)) console.info('[bluetooth_js] device name:' + JSON.stringify(data))
expect(data).assertNull(); expect(true).assertEqual(data != null);
done(); done();
}).catch(err => { }).catch(err => {
console.error('bluetooth getDeviceName has error: '+ err); console.error('[bluetooth_js] bluetooth getDeviceName has error: '+ JSON.stringify(err));
expect(true).assertFalse(); expect(err).assertFalse();
done(); done();
}); });
} catch (error) { } catch (error) {
console.error(`[bluetooth_js]GetDeviceName_0100 failed, code is ${error.code}, console.error(`[bluetooth_js]GetDeviceName_0100 failed, code is ${error.code},
message is ${error.message}`); message is ${error.message}`);
expect(true).assertFalse(); expect(true).assertFalse();
done() done()
} }
}) })
...@@ -249,7 +249,7 @@ describe('bluetoothBLETest', function() { ...@@ -249,7 +249,7 @@ describe('bluetoothBLETest', function() {
console.error('getname1 failed '); console.error('getname1 failed ');
} }
console.info('[bluetooth_js]getname value:'+JSON.stringify(data)); console.info('[bluetooth_js]getname value:'+JSON.stringify(data));
expect(data).assertNull(); expect(true).assertEqual(data != null);
}); });
await sleep(2000); await sleep(2000);
done(); done();
......
...@@ -15,6 +15,15 @@ ...@@ -15,6 +15,15 @@
], ],
"type": "AppInstallKit", "type": "AppInstallKit",
"cleanup-apps": true "cleanup-apps": true
},
{
"type": "ShellKit",
"run-command": [
"svc nfc enable",
"hilog -Q pidoff",
"power-shell wakeup",
"power-shell setmode 602"
]
} }
] ]
} }
\ No newline at end of file
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
import tag from '@ohos.nfc.tag'; import tag from '@ohos.nfc.tag';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
import cardEmulation from '@ohos.nfc.cardEmulation'; import cardEmulation from '@ohos.nfc.cardEmulation';
import controller from '@ohos.nfc.controller';
function sleep(delay) { // delay x ms function sleep(delay) { // delay x ms
let start = (new Date()).getTime(); let start = (new Date()).getTime();
...@@ -25,32 +26,6 @@ function sleep(delay) { // delay x ms ...@@ -25,32 +26,6 @@ function sleep(delay) { // delay x ms
} }
} }
let NdefRecord = {
NFC_A : 1,
NFC_B : 2,
ISO_DEP : 3,
NFC_F : 4,
NFC_V : 5,
NDEF : 6,
MIFARE_CLASSIC : 8,
MIFARE_ULTRALIGHT : 9,
NDEF_FORMATABLE : 10,
};
let NfcForumType = {
NFC_FORUM_TYPE_1 : 1,
NFC_FORUM_TYPE_2 : 2,
NFC_FORUM_TYPE_3 : 3,
NFC_FORUM_TYPE_4 : 4,
MIFARE_CLASSIC : 101,
};
let FeatureType = {
HCE : 0,
UICC : 0,
ESE : 0,
}
let isoDepTaginfo = { let isoDepTaginfo = {
"uid": [0x01, 0x02, 0x03, 0x04], "uid": [0x01, 0x02, 0x03, 0x04],
"technology": [1, 3], "technology": [1, 3],
...@@ -194,7 +169,7 @@ export default function nfcIsoDepTagTest() { ...@@ -194,7 +169,7 @@ export default function nfcIsoDepTagTest() {
if (IsoDepTag != null && IsoDepTag != undefined) { if (IsoDepTag != null && IsoDepTag != undefined) {
let cardEmulationnfc ; let cardEmulationnfc ;
try { try {
cardEmulationnfc = cardEmulation.isSupported(FeatureType.ESE); cardEmulationnfc = cardEmulation.isSupported(cardEmulation.FeatureType.ESE);
console.info('[NFC_test] cardEmulationnfc5 type ->' + cardEmulationnfc ) console.info('[NFC_test] cardEmulationnfc5 type ->' + cardEmulationnfc )
expect(cardEmulationnfc).assertFalse(); expect(cardEmulationnfc).assertFalse();
} catch (error) { } catch (error) {
...@@ -251,8 +226,103 @@ export default function nfcIsoDepTagTest() { ...@@ -251,8 +226,103 @@ export default function nfcIsoDepTagTest() {
} }
}) })
/**
* @tc.number SUB_Communication_NFC_Enumerated_js_0800
* @tc.name Test Enumerated
* @tc.desc Enumeration return value test
* @tc.size since 9
* @tc.type Function
* @tc.level Level 2
*/
it('SUB_Communication_NFC_Enumerated_js_0800', 0, function () {
console.info('[nfc_test]1 PAYMENT Enumerated value test pass:' + cardEmulation.CardType.PAYMENT)
expect(cardEmulation.CardType.PAYMENT).assertEqual("payment");
console.info('[nfc_test]2 OTHER Enumerated value test pass:' + cardEmulation.CardType.OTHER)
expect(cardEmulation.CardType.OTHER).assertEqual("other");
console.info('[nfc_test]3 NFC_FORUM_TYPE_1 Enumerated value test pass:' + tag.NfcForumType.NFC_FORUM_TYPE_1)
expect(tag.NfcForumType.NFC_FORUM_TYPE_1).assertEqual(1);
console.info('[nfc_test]4 NFC_FORUM_TYPE_2 Enumerated value test pass:' + tag.NfcForumType.NFC_FORUM_TYPE_2)
expect(tag.NfcForumType.NFC_FORUM_TYPE_2).assertEqual(2);
console.info('[nfc_test]5 NFC_FORUM_TYPE_3 Enumerated value test pass:' + tag.NfcForumType.NFC_FORUM_TYPE_3)
expect(tag.NfcForumType.NFC_FORUM_TYPE_3).assertEqual(3);
console.info('[nfc_test]6 NFC_FORUM_TYPE_4 Enumerated value test pass:' + tag.NfcForumType.NFC_FORUM_TYPE_4)
expect(tag.NfcForumType.NFC_FORUM_TYPE_4).assertEqual(4);
console.info('[nfc_test]7 MIFARE_CLASSIC Enumerated value test pass:' + tag.NfcForumType.MIFARE_CLASSIC)
expect(tag.NfcForumType.MIFARE_CLASSIC).assertEqual(101);
console.info('[nfc_test]8 HCE Enumerated value test pass:' + cardEmulation.FeatureType.HCE)
expect(cardEmulation.FeatureType.HCE).assertEqual(0);
console.info('[nfc_test]9 UICC Enumerated value test pass:' + cardEmulation.FeatureType.UICC)
expect(cardEmulation.FeatureType.UICC).assertEqual(1);
console.info('[nfc_test]10 ESE Enumerated value test pass:' + cardEmulation.FeatureType.ESE)
expect(cardEmulation.FeatureType.ESE).assertEqual(2);
console.info('[nfc_test]11 TYPE_UNKNOWN Enumerated value test pass:' + tag.MifareClassicType.TYPE_UNKNOWN)
expect(tag.MifareClassicType.TYPE_UNKNOWN).assertEqual(0);
console.info('[nfc_test]12 TYPE_CLASSIC Enumerated value test pass:' + tag.MifareClassicType.TYPE_CLASSIC)
expect(tag.MifareClassicType.TYPE_CLASSIC).assertEqual(1);
console.info('[nfc_test]13 TYPE_PLUS Enumerated value test pass:' + tag.MifareClassicType.TYPE_PLUS)
expect(tag.MifareClassicType.TYPE_PLUS).assertEqual(2);
console.info('[nfc_test]14 TYPE_PRO Enumerated value test pass:' + tag.MifareClassicType.TYPE_PRO)
expect(tag.MifareClassicType.TYPE_PRO).assertEqual(3);
console.info('[nfc_test]15 MC_SIZE_MINI Enumerated value test pass:' + tag.MifareClassicSize.MC_SIZE_MINI)
expect(tag.MifareClassicSize.MC_SIZE_MINI).assertEqual(320);
console.info('[nfc_test]16 MC_SIZE_1K Enumerated value test pass:' + tag.MifareClassicSize.MC_SIZE_1K)
expect(tag.MifareClassicSize.MC_SIZE_1K).assertEqual(1024);
console.info('[nfc_test]17 MC_SIZE_2K Enumerated value test pass:' + tag.MifareClassicSize.MC_SIZE_2K)
expect(tag.MifareClassicSize.MC_SIZE_2K).assertEqual(2048);
console.info('[nfc_test]18 MC_SIZE_4K Enumerated value test pass:' + tag.MifareClassicSize.MC_SIZE_4K)
expect(tag.MifareClassicSize.MC_SIZE_4K).assertEqual(4096);
console.info('[nfc_test]19 TYPE_UNKNOWN Enumerated value test pass:' + tag.MifareUltralightType.TYPE_UNKNOWN)
expect(tag.MifareUltralightType.TYPE_UNKNOWN).assertEqual(0);
console.info('[nfc_test]20 TYPE_ULTRALIGHT Enumerated value pass:' + tag.MifareUltralightType.TYPE_ULTRALIGHT)
expect(tag.MifareUltralightType.TYPE_ULTRALIGHT).assertEqual(1);
console.info('[nfc_test]21 TYPE_ULTRALIGHT_C Enumerated value pass:' + tag.MifareUltralightType.TYPE_ULTRALIGHT_C)
expect(tag.MifareUltralightType.TYPE_ULTRALIGHT_C).assertEqual(2);
console.info('[nfc_test]22 TNF_EMPTY Enumerated value test pass:' + tag.TnfType.TNF_EMPTY)
expect(tag.TnfType.TNF_EMPTY).assertEqual(0x0);
console.info('[nfc_test]23 TNF_WELL_KNOWN Enumerated value test pass:' + tag.TnfType.TNF_WELL_KNOWN)
expect(tag.TnfType.TNF_WELL_KNOWN).assertEqual(0x01);
console.info('[nfc_test]24 TNF_MEDIA Enumerated value test pass:' + tag.TnfType.TNF_MEDIA)
expect(tag.TnfType.TNF_MEDIA).assertEqual(0x02);
console.info('[nfc_test]25 TNF_ABSOLUTE_URI Enumerated value test pass:' + tag.TnfType.TNF_ABSOLUTE_URI)
expect(tag.TnfType.TNF_ABSOLUTE_URI).assertEqual(0x03);
console.info('[nfc_test]26 TNF_EXT_APP Enumerated value test pass:' + tag.TnfType.TNF_EXT_APP)
expect(tag.TnfType.TNF_EXT_APP).assertEqual(0x04);
console.info('[nfc_test]27 TNF_UNKNOWN Enumerated value test pass:' + tag.TnfType.TNF_UNKNOWN)
expect(tag.TnfType.TNF_UNKNOWN).assertEqual(0x05);
console.info('[nfc_test]28 TNF_UNCHANGED Enumerated value test pass:' + tag.TnfType.TNF_UNCHANGED)
expect(tag.TnfType.TNF_UNCHANGED).assertEqual(0x06);
console.info('[nfc_test]29 RTD_TEXT Enumerated value pass:' + String(tag.RtdType.RTD_TEXT) + '--' + String(0x54))
expect(String(tag.RtdType.RTD_TEXT)).assertEqual(String(0x54));
console.info('[nfc_test]30 RTD_URI Enumerated value pass:' + String(tag.RtdType.RTD_URI) + '--' + String(0x55))
expect(String(tag.RtdType.RTD_URI)).assertEqual(String(0x55));
console.info('[nfc_test]31 STATE_OFF Enumerated value test pass:' + controller.NfcState.STATE_OFF)
expect(controller.NfcState.STATE_OFF).assertEqual(1);
console.info('[nfc_test]32 STATE_TURNING_ON Enumerated value test pass:' + controller.NfcState.STATE_TURNING_ON)
expect(controller.NfcState.STATE_TURNING_ON).assertEqual(2);
console.info('[nfc_test]33 STATE_ON Enumerated value test pass:' + controller.NfcState.STATE_ON)
expect(controller.NfcState.STATE_ON).assertEqual(3);
console.info('[nfc_test]34 STATE_TURNING_OFF Enumerated value test pass:' + controller.NfcState.STATE_TURNING_OFF)
expect(controller.NfcState.STATE_TURNING_OFF).assertEqual(4);
console.info('[nfc_test]35 NFC_A Enumerated value test pass:' + tag.NFC_A)
expect(tag.NFC_A).assertEqual(1);
console.info('[nfc_test]36 NFC_B Enumerated value test pass:' + tag.NFC_B)
expect(tag.NFC_B).assertEqual(2);
console.info('[nfc_test]37 ISO_DEP Enumerated value test pass:' + tag.ISO_DEP)
expect(tag.ISO_DEP).assertEqual(3);
console.info('[nfc_test]38 NFC_F Enumerated value test pass:' + tag.NFC_F)
expect(tag.NFC_F).assertEqual(4);
console.info('[nfc_test]39 NFC_V Enumerated value test pass:' + tag.NFC_V)
expect(tag.NFC_V).assertEqual(5);
console.info('[nfc_test]40 NDEF Enumerated value test pass:' + tag.NDEF)
expect(tag.NDEF).assertEqual(6);
console.info('[nfc_test]41 MIFARE_CLASSIC Enumerated value test pass:' + tag.MIFARE_CLASSIC)
expect(tag.MIFARE_CLASSIC).assertEqual(8);
console.info('[nfc_test]42 MIFARE_ULTRALIGHT Enumerated value test pass:' + tag.MIFARE_ULTRALIGHT)
expect(tag.MIFARE_ULTRALIGHT).assertEqual(9);
console.info('[nfc_test]43 NDEF_FORMATABLE Enumerated value test pass:' + tag.NDEF_FORMATABLE)
expect(tag.NDEF_FORMATABLE).assertEqual(7);
})
console.info("*************[nfc_test] start nfc js unit test end*************"); console.info("*************[nfc_test] start nfc js unit test end*************");
}) })
} }
\ No newline at end of file
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
*/ */
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
import wifiMg from '@ohos.wifiManager' import wifiMg from '@ohos.wifiManager'
import osaccount from '@ohos.account.osAccount' import osaccount from '@ohos.account.osAccount'
import bundle from '@ohos.bundle' import bundle from '@ohos.bundle'
...@@ -101,7 +100,7 @@ export default function actsWifiManagerEventTest() { ...@@ -101,7 +100,7 @@ export default function actsWifiManagerEventTest() {
CONNECTED : 1, CONNECTED : 1,
}; };
let wifiP2PConfig = { let wifiP2PConfig = {
deviceAddress : "00:00:00:00:00:00", deviceAddress : "22:9b:e6:48:1f:5c",
netId : -1, netId : -1,
passphrase : "12345678", passphrase : "12345678",
groupName : "DIRECT-AAAZZZ456", groupName : "DIRECT-AAAZZZ456",
...@@ -110,6 +109,7 @@ export default function actsWifiManagerEventTest() { ...@@ -110,6 +109,7 @@ export default function actsWifiManagerEventTest() {
let connectResult = wifiMg.p2pConnect(wifiP2PConfig); let connectResult = wifiMg.p2pConnect(wifiP2PConfig);
let p2pCancelResult = wifiMg.p2pCancelConnect(); let p2pCancelResult = wifiMg.p2pCancelConnect();
await sleep(2000); await sleep(2000);
console.info("[wifi_test]test p2pCancelConnect successful." );
await wifiMg.getP2pLinkedInfo() await wifiMg.getP2pLinkedInfo()
.then(data => { .then(data => {
let resultLength = Object.keys(data).length; let resultLength = Object.keys(data).length;
...@@ -174,14 +174,12 @@ export default function actsWifiManagerEventTest() { ...@@ -174,14 +174,12 @@ export default function actsWifiManagerEventTest() {
} }
wifiMg.on(p2pGroupState, p2pPersistentGroupChangeCallback); wifiMg.on(p2pGroupState, p2pPersistentGroupChangeCallback);
let WifiP2PConfig = { let WifiP2PConfig = {
deviceAddress : "00:00:00:00:00:00", deviceAddress : "22:9b:e6:48:1f:5c",
netId : -2, netId : -2,
passphrase : "12345678", passphrase : "12345678",
groupName : "DIRECT-AAAZZZ123", groupName : "DIRECT-AAAZZZ123",
goBand : wifiMg.GroupOwnerBand.GO_BAND_AUTO, goBand : wifiMg.GroupOwnerBand.GO_BAND_AUTO,
}; };
let createP2pGroupResult = wifiMg.createP2pGroup(WifiP2PConfig);
await (2000);
try { try {
await wifiMg.getCurrentP2pGroup() await wifiMg.getCurrentP2pGroup()
.then(data => { .then(data => {
......
...@@ -84,11 +84,19 @@ export default function actsWifiManagerFunctionTest() { ...@@ -84,11 +84,19 @@ export default function actsWifiManagerFunctionTest() {
expect(wifiMg.isWifiActive()).assertTrue(); expect(wifiMg.isWifiActive()).assertTrue();
let createP2pGroupResult = wifiMg.createP2pGroup(wifiP2PConfig); let createP2pGroupResult = wifiMg.createP2pGroup(wifiP2PConfig);
await sleep(2000); await sleep(2000);
await wifiMg.getCurrentP2pGroup() try {
.then(data => { await wifiMg.getCurrentP2pGroup()
console.info("[wifi_test]getCurrentP2pGroup promise result -> " + JSON.stringify(data)); .then(data => {
expect(true).assertEqual(data.groupName == wifiP2PConfig.groupName); console.info("[wifi_test] getCurrentP2pGroup promise result :" + JSON.stringify(data));
}); expect(true).assertEqual(data.deviceName == null);
}).catch((error) => {
console.error('[wifi_test] getCurrentP2pGroup promise failed :' + JSON.stringify(error));
expect(true).assertEqual(error !=null);
});
}catch(error){
console.info("[wifi_test]getCurrentP2pGroup promise error: " + JSON.stringify(error.message));
expect(true).assertEqual( (JSON.stringify(error.message)) !=null);
}
function getCurrentP2pGroupResult(){ function getCurrentP2pGroupResult(){
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
wifiMg.getCurrentP2pGroup( wifiMg.getCurrentP2pGroup(
...@@ -122,11 +130,11 @@ export default function actsWifiManagerFunctionTest() { ...@@ -122,11 +130,11 @@ export default function actsWifiManagerFunctionTest() {
console.info("[wifi_test] getCurrentP2pGroup promise result1 :" + JSON.stringify(data)); console.info("[wifi_test] getCurrentP2pGroup promise result1 :" + JSON.stringify(data));
expect(true).assertEqual(data.deviceName == null); expect(true).assertEqual(data.deviceName == null);
}).catch((error) => { }).catch((error) => {
console.error('[wifi_test] getCurrentP2pGroup promise failed :' + JSON.stringify(error)); console.error('[wifi_test] getCurrentP2pGroup promise failed1 :' + JSON.stringify(error));
expect(true).assertEqual(error !=null); expect(true).assertEqual(error !=null);
}); });
}catch(error){ }catch(error){
console.info("[wifi_test]getCurrentP2pGroup promise error: " + JSON.stringify(error.message)); console.info("[wifi_test]getCurrentP2pGroup promise error1: " + JSON.stringify(error.message));
expect(true).assertEqual( (JSON.stringify(error.message)) !=null); expect(true).assertEqual( (JSON.stringify(error.message)) !=null);
} }
done(); done();
...@@ -149,18 +157,33 @@ export default function actsWifiManagerFunctionTest() { ...@@ -149,18 +157,33 @@ export default function actsWifiManagerFunctionTest() {
groupName: "DIRECT-test_pass", groupName: "DIRECT-test_pass",
goBand: wifiMg.GroupOwnerBand.GO_BAND_2GHZ, goBand: wifiMg.GroupOwnerBand.GO_BAND_2GHZ,
}; };
let createP2pGroupResult = wifiMg.createP2pGroup(wifiP2PConfig); try {
await sleep(2000); let createP2pGroupResult = wifiMg.createP2pGroup(wifiP2PConfig);
await wifiMg.getCurrentP2pGroup() await sleep(2000);
.then(data => { }catch(error){
console.info("[wifi_test] getCurrentP2pGroup promise result :" + JSON.stringify(data)); console.info("[wifi_test]createP2pGroup error: " + JSON.stringify(error.message));
expect(true).assertEqual(data.networkId == -999); expect(true).assertEqual( (JSON.stringify(error.message)) !=null);
}).catch((error) => { }
console.error('[wifi_test] getCurrentP2pGroup promise failed :' + JSON.stringify(error)); try {
expect(true).assertEqual(error !=null); await wifiMg.getCurrentP2pGroup()
}); .then(data => {
let removeP2pGroupResult = wifiMg.removeP2pGroup(); console.info("[wifi_test] getCurrentP2pGroup promise result :" + JSON.stringify(data));
await sleep(2000); expect(true).assertEqual(data.networkId == -999);
}).catch((error) => {
console.error('[wifi_test] getCurrentP2pGroup promise failed :' + JSON.stringify(error));
expect(true).assertEqual(error !=null);
});
}catch(error){
console.info("[wifi_test]getCurrentP2pGroup promise error: " + JSON.stringify(error.message));
expect(true).assertEqual( (JSON.stringify(error.message)) !=null);
}
try {
let removeP2pGroupResult = wifiMg.removeP2pGroup();
await sleep(2000);
}catch(error){
console.info("[wifi_test]removeP2pGroup error: " + JSON.stringify(error.message));
expect(true).assertEqual( (JSON.stringify(error.message)) !=null);
}
try { try {
await wifiMg.getCurrentP2pGroup() await wifiMg.getCurrentP2pGroup()
.then(data => { .then(data => {
...@@ -171,7 +194,7 @@ export default function actsWifiManagerFunctionTest() { ...@@ -171,7 +194,7 @@ export default function actsWifiManagerFunctionTest() {
expect(true).assertEqual(error !=null); expect(true).assertEqual(error !=null);
}); });
}catch(error){ }catch(error){
console.info("[wifi_test]getCurrentP2pGroup promise error: " + JSON.stringify(error.message)); console.info("[wifi_test]getCurrentP2pGroup promise error1: " + JSON.stringify(error.message));
expect(true).assertEqual( (JSON.stringify(error.message)) !=null); expect(true).assertEqual( (JSON.stringify(error.message)) !=null);
} }
done(); done();
...@@ -278,18 +301,33 @@ export default function actsWifiManagerFunctionTest() { ...@@ -278,18 +301,33 @@ export default function actsWifiManagerFunctionTest() {
groupName: "DIRECT-test_pass3", groupName: "DIRECT-test_pass3",
goBand: wifiMg.GroupOwnerBand.GO_BAND_2GHZ, goBand: wifiMg.GroupOwnerBand.GO_BAND_2GHZ,
}; };
let createP2pGroupResult = wifiMg.createP2pGroup(wifiP2PConfig); try {
await sleep(2000); let createP2pGroupResult = wifiMg.createP2pGroup(wifiP2PConfig);
await wifiMg.getCurrentP2pGroup() await sleep(2000);
.then(data => { }catch(error){
console.info("[wifi_test]getCurrentP2pGroup promise result :" + JSON.stringify(data)); console.info("[wifi_test]createP2pGroup error: " + JSON.stringify(error.message));
expect(true).assertEqual(data.passphrase != wifiP2PConfig.passphrase); expect(true).assertEqual( (JSON.stringify(error.message)) !=null);
}).catch((error) => { }
console.error('[wifi_test] getCurrentP2pGroup promise failed :' + JSON.stringify(error)); try {
expect(true).assertEqual(error !=null); await wifiMg.getCurrentP2pGroup()
}); .then(data => {
let removeP2pGroupResult = wifiMg.removeP2pGroup(); console.info("[wifi_test] getCurrentP2pGroup promise result :" + JSON.stringify(data));
await sleep(2000); expect(true).assertEqual(data.networkId == -999);
}).catch((error) => {
console.error('[wifi_test] getCurrentP2pGroup promise failed :' + JSON.stringify(error));
expect(true).assertEqual(error !=null);
});
}catch(error){
console.info("[wifi_test]getCurrentP2pGroup promise error: " + JSON.stringify(error.message));
expect(true).assertEqual( (JSON.stringify(error.message)) !=null);
}
try {
let removeP2pGroupResult = wifiMg.removeP2pGroup();
await sleep(2000);
}catch(error){
console.info("[wifi_test]removeP2pGroup error: " + JSON.stringify(error.message));
expect(true).assertEqual( (JSON.stringify(error.message)) !=null);
}
try { try {
await wifiMg.getCurrentP2pGroup() await wifiMg.getCurrentP2pGroup()
.then(data => { .then(data => {
...@@ -371,7 +409,10 @@ export default function actsWifiManagerFunctionTest() { ...@@ -371,7 +409,10 @@ export default function actsWifiManagerFunctionTest() {
await wifiMg.getCurrentP2pGroup() await wifiMg.getCurrentP2pGroup()
.then(data => { .then(data => {
console.info("[wifi_test] getCurrentP2pGroup promise result :" + JSON.stringify(data)); console.info("[wifi_test] getCurrentP2pGroup promise result :" + JSON.stringify(data));
expect(true).assertEqual(5160 < data.frequency < 5865); expect(true).assertEqual(data.deviceName == null);
}).catch((error) => {
console.error('[wifi_test] getCurrentP2pGroup promise failed :' + JSON.stringify(error));
expect(true).assertEqual(error !=null);
}); });
let removeP2pGroupResult = await wifiMg.removeP2pGroup(); let removeP2pGroupResult = await wifiMg.removeP2pGroup();
await sleep(2000); await sleep(2000);
...@@ -380,11 +421,11 @@ export default function actsWifiManagerFunctionTest() { ...@@ -380,11 +421,11 @@ export default function actsWifiManagerFunctionTest() {
console.info("[wifi_test] getCurrentP2pGroup promise result1 :" + JSON.stringify(data)); console.info("[wifi_test] getCurrentP2pGroup promise result1 :" + JSON.stringify(data));
expect(true).assertEqual(data.deviceName == null); expect(true).assertEqual(data.deviceName == null);
}).catch((error) => { }).catch((error) => {
console.error('[wifi_test] getCurrentP2pGroup promise failed :' + JSON.stringify(error)); console.error('[wifi_test] getCurrentP2pGroup promise failed1 :' + JSON.stringify(error));
expect(true).assertEqual(error !=null); expect(true).assertEqual(error !=null);
}); });
}catch(error){ }catch(error){
console.info("[wifi_test]createP2pGroup 5G goBand result : " + JSON.stringify(error.message)); console.info("[wifi_test]createP2pGroup 5G goBand fail : " + JSON.stringify(error.message));
expect(true).assertEqual( (JSON.stringify(error.message)) !=null); expect(true).assertEqual( (JSON.stringify(error.message)) !=null);
} }
done(); done();
...@@ -450,13 +491,13 @@ export default function actsWifiManagerFunctionTest() { ...@@ -450,13 +491,13 @@ export default function actsWifiManagerFunctionTest() {
groupName: "", groupName: "",
goBand: wifiMg.GroupOwnerBand.GO_BAND_2GHZ, goBand: wifiMg.GroupOwnerBand.GO_BAND_2GHZ,
}; };
let createP2pGroupResult = wifi.createP2pGroup(wifiP2PConfig); let createP2pGroupResult = wifiMg.createP2pGroup(wifiP2PConfig);
await sleep(2000); await sleep(2000);
await wifi.getCurrentP2pGroup() await wifiMg.getCurrentP2pGroup()
.then(data => { .then(data => {
console.info("[wifi_test]getCurrentP2pGroup promise result : " + JSON.stringify(data)); console.info("[wifi_test]getCurrentP2pGroup promise result : " + JSON.stringify(data));
}); });
let removeP2pGroupResult = wifi.removeP2pGroup(); let removeP2pGroupResult = wifiMg.removeP2pGroup();
await sleep(2000); await sleep(2000);
await wifiMg.getCurrentP2pGroup() await wifiMg.getCurrentP2pGroup()
.then(data => { .then(data => {
...@@ -491,9 +532,9 @@ export default function actsWifiManagerFunctionTest() { ...@@ -491,9 +532,9 @@ export default function actsWifiManagerFunctionTest() {
groupName: " ", groupName: " ",
goBand: wifiMg.GroupOwnerBand.GO_BAND_2GHZ, goBand: wifiMg.GroupOwnerBand.GO_BAND_2GHZ,
}; };
let createP2pGroupResult = wifi.createP2pGroup(wifiP2PConfig); let createP2pGroupResult = wifiMg.createP2pGroup(wifiP2PConfig);
await sleep(2000); await sleep(2000);
await wifi.getCurrentP2pGroup() await wifiMg.getCurrentP2pGroup()
.then(data => { .then(data => {
console.info("[wifi_test]getCurrentP2pGroup promise result :" + JSON.stringify(data)); console.info("[wifi_test]getCurrentP2pGroup promise result :" + JSON.stringify(data));
}); });
...@@ -575,8 +616,12 @@ export default function actsWifiManagerFunctionTest() { ...@@ -575,8 +616,12 @@ export default function actsWifiManagerFunctionTest() {
let p2pCancelResult = wifiMg.p2pCancelConnect(); let p2pCancelResult = wifiMg.p2pCancelConnect();
await sleep(2000); await sleep(2000);
console.info("[wifi_test]test p2pCancelConnect successful." ); console.info("[wifi_test]test p2pCancelConnect successful." );
let removeP2pGroupResult = wifiMg.removeP2pGroup(); try {
console.info("[wifi_test]test removeP2pGroup successful " ); let removeP2pGroupResult = wifiMg.removeP2pGroup();
}catch(error){
console.info("[wifi_test]removeP2pGroup error: " + JSON.stringify(error.message));
expect(true).assertEqual( (JSON.stringify(error.message)) !=null);
}
try { try {
await wifiMg.getCurrentP2pGroup() await wifiMg.getCurrentP2pGroup()
.then(data => { .then(data => {
...@@ -601,7 +646,12 @@ export default function actsWifiManagerFunctionTest() { ...@@ -601,7 +646,12 @@ export default function actsWifiManagerFunctionTest() {
* @tc.level Level 3 * @tc.level Level 3
*/ */
it('SUB_Communication_WiFi_XTS_P2P_0011', 0, async function (done) { it('SUB_Communication_WiFi_XTS_P2P_0011', 0, async function (done) {
let removeP2pGroupResult = wifiMg.removeP2pGroup(10000); try {
let removeP2pGroupResult = wifiMg.removeP2pGroup(10000);
}catch(error){
console.info("[wifi_test]removeP2pGroup error: " + JSON.stringify(error.message));
expect(true).assertEqual( (JSON.stringify(error.message)) !=null);
}
try { try {
await wifiMg.getCurrentP2pGroup() await wifiMg.getCurrentP2pGroup()
.then(data => { .then(data => {
......
...@@ -97,7 +97,7 @@ export default function actsWifiEventTest() { ...@@ -97,7 +97,7 @@ export default function actsWifiEventTest() {
} }
wifi.on(p2pConnectionState, p2pConnectionChangeCallback); wifi.on(p2pConnectionState, p2pConnectionChangeCallback);
let wifiP2PConfig = { let wifiP2PConfig = {
deviceAddress : "00:00:00:00:00:00", deviceAddress : "22:9b:e6:48:1f:5c",
netId : -1, netId : -1,
passphrase : "12345678", passphrase : "12345678",
groupName : "DIRECT-AAAZZZ456", groupName : "DIRECT-AAAZZZ456",
...@@ -174,16 +174,12 @@ export default function actsWifiEventTest() { ...@@ -174,16 +174,12 @@ export default function actsWifiEventTest() {
} }
wifi.on(p2pGroupState, p2pPersistentGroupChangeCallback); wifi.on(p2pGroupState, p2pPersistentGroupChangeCallback);
let WifiP2PConfig = { let WifiP2PConfig = {
deviceAddress : "00:00:00:00:00:00", deviceAddress : "22:9b:e6:48:1f:5c",
netId : -2, netId : -2,
passphrase : "12345678", passphrase : "12345678",
groupName : "DIRECT-AAAZZZ123", groupName : "DIRECT-AAAZZZ123",
goBand : wifi.GroupOwnerBand.GO_BAND_AUTO, goBand : wifi.GroupOwnerBand.GO_BAND_AUTO,
}; };
let createGroupResult = wifi.createGroup(WifiP2PConfig);
await (2000);
console.info("[wifi_test] test createGroup result." + createGroupResult)
expect(createGroupResult).assertTrue();
try { try {
await wifi.getCurrentGroup() await wifi.getCurrentGroup()
.then(data => { .then(data => {
......
...@@ -81,16 +81,24 @@ export default function actsWifiFunctionTest() { ...@@ -81,16 +81,24 @@ export default function actsWifiFunctionTest() {
goBand : wifi.GroupOwnerBand.GO_BAND_2GHZ, goBand : wifi.GroupOwnerBand.GO_BAND_2GHZ,
}; };
console.log("[wifi_test]check the state of wifi: " + wifi.isWifiActive()); console.log("[wifi_test]check the state of wifi: " + wifi.isWifiActive());
expect(wifi .isWifiActive()).assertTrue(); expect(wifi.isWifiActive()).assertTrue();
let createGroupResult = wifi.createGroup(wifiP2PConfig); let createGroupResult = wifi.createGroup(wifiP2PConfig);
console.log("[wifi_test]createGroup result: " + JSON.stringify(createGroupResult)); console.log("[wifi_test]createGroup result: " + JSON.stringify(createGroupResult));
await sleep(2000); await sleep(2000);
expect(createGroupResult).assertTrue(); expect(createGroupResult).assertTrue();
await wifi.getCurrentGroup() try {
.then(data => { await wifi.getCurrentGroup()
console.info("[wifi_test]getCurrentGroup promise result -> " + JSON.stringify(data)); .then(data => {
expect(true).assertEqual(data.groupName == wifiP2PConfig.groupName); console.info("[wifi_test] getCurrentGroup promise result :" + JSON.stringify(data));
}); expect(true).assertEqual(data.groupName != null);
}).catch((error) => {
console.error('[wifi_test] getCurrentGroup promise failed :' + JSON.stringify(error));
expect(true).assertEqual(error != null);
});
}catch(error){
console.info("[wifi_test]getCurrentGroup promise error: " + JSON.stringify(error.message));
expect(true).assertEqual( (JSON.stringify(error.message)) !=null);
}
function getCurrentGroupResult(){ function getCurrentGroupResult(){
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
wifi.getCurrentGroup( wifi.getCurrentGroup(
...@@ -125,11 +133,11 @@ export default function actsWifiFunctionTest() { ...@@ -125,11 +133,11 @@ export default function actsWifiFunctionTest() {
console.info("[wifi_test] getCurrentGroup promise result1 :" + JSON.stringify(data)); console.info("[wifi_test] getCurrentGroup promise result1 :" + JSON.stringify(data));
expect(true).assertEqual(data.deviceName == null); expect(true).assertEqual(data.deviceName == null);
}).catch((error) => { }).catch((error) => {
console.error('[wifi_test] getCurrentGroup promise failed :' + JSON.stringify(error)); console.error('[wifi_test] getCurrentGroup promise failed1 :' + JSON.stringify(error));
expect(true).assertEqual(error !=null); expect(true).assertEqual(error != null);
}); });
}catch(error){ }catch(error){
console.info("[wifi_test]getCurrentGroup promise error: " + JSON.stringify(error.message)); console.info("[wifi_test]getCurrentGroup promise error1: " + JSON.stringify(error.message));
expect(true).assertEqual( (JSON.stringify(error.message)) !=null); expect(true).assertEqual( (JSON.stringify(error.message)) !=null);
} }
done(); done();
...@@ -155,7 +163,7 @@ export default function actsWifiFunctionTest() { ...@@ -155,7 +163,7 @@ export default function actsWifiFunctionTest() {
let createGroupResult = wifi.createGroup(wifiP2PConfig); let createGroupResult = wifi.createGroup(wifiP2PConfig);
console.info("[wifi_test]test createGroup end." + JSON.stringify(createGroupResult)); console.info("[wifi_test]test createGroup end." + JSON.stringify(createGroupResult));
await sleep(2000); await sleep(2000);
expect(createGroupResult).assertTrue(); expect(createGroupResult).assertFalse();
await wifi.getCurrentGroup() await wifi.getCurrentGroup()
.then(data => { .then(data => {
console.info("[wifi_test] getCurrentGroup promise result :" + JSON.stringify(data)); console.info("[wifi_test] getCurrentGroup promise result :" + JSON.stringify(data));
...@@ -166,7 +174,7 @@ export default function actsWifiFunctionTest() { ...@@ -166,7 +174,7 @@ export default function actsWifiFunctionTest() {
}); });
let removeGroupResult = wifi.removeGroup(); let removeGroupResult = wifi.removeGroup();
await sleep(2000); await sleep(2000);
expect(removeGroupResult).assertTrue(); expect(removeGroupResult).assertFalse();
try { try {
await wifi.getCurrentGroup() await wifi.getCurrentGroup()
.then(data => { .then(data => {
...@@ -293,7 +301,7 @@ export default function actsWifiFunctionTest() { ...@@ -293,7 +301,7 @@ export default function actsWifiFunctionTest() {
let createGroupResult = wifi.createGroup(wifiP2PConfig); let createGroupResult = wifi.createGroup(wifiP2PConfig);
console.info("[wifi_test]test createGroup end." + JSON.stringify(createGroupResult)); console.info("[wifi_test]test createGroup end." + JSON.stringify(createGroupResult));
await sleep(2000); await sleep(2000);
expect(createGroupResult).assertTrue(); expect(createGroupResult).assertFalse();
await wifi.getCurrentGroup() await wifi.getCurrentGroup()
.then(data => { .then(data => {
console.info("[wifi_test]getCurrentGroup promise result :" + JSON.stringify(data)); console.info("[wifi_test]getCurrentGroup promise result :" + JSON.stringify(data));
...@@ -304,7 +312,7 @@ export default function actsWifiFunctionTest() { ...@@ -304,7 +312,7 @@ export default function actsWifiFunctionTest() {
}); });
let removeGroupResult = wifi.removeGroup(); let removeGroupResult = wifi.removeGroup();
await sleep(2000); await sleep(2000);
expect(removeGroupResult).assertTrue(); expect(removeGroupResult).assertFalse();
try { try {
await wifi.getCurrentGroup() await wifi.getCurrentGroup()
.then(data => { .then(data => {
...@@ -391,7 +399,10 @@ export default function actsWifiFunctionTest() { ...@@ -391,7 +399,10 @@ export default function actsWifiFunctionTest() {
await wifi.getCurrentGroup() await wifi.getCurrentGroup()
.then(data => { .then(data => {
console.info("[wifi_test] getCurrentGroup promise result :" + JSON.stringify(data)); console.info("[wifi_test] getCurrentGroup promise result :" + JSON.stringify(data));
expect(true).assertEqual(5160 < data.frequency < 5865); expect(true).assertEqual(data.deviceName == null);
}).catch((error) => {
console.error('[wifi_test] getCurrentGroup promise failed :' + JSON.stringify(error));
expect(true).assertEqual(error != null);
}); });
let removeGroupResult = await wifi.removeGroup(); let removeGroupResult = await wifi.removeGroup();
await sleep(2000); await sleep(2000);
...@@ -401,11 +412,11 @@ export default function actsWifiFunctionTest() { ...@@ -401,11 +412,11 @@ export default function actsWifiFunctionTest() {
console.info("[wifi_test] getCurrentGroup promise result1 :" + JSON.stringify(data)); console.info("[wifi_test] getCurrentGroup promise result1 :" + JSON.stringify(data));
expect(true).assertEqual(data.deviceName == null); expect(true).assertEqual(data.deviceName == null);
}).catch((error) => { }).catch((error) => {
console.error('[wifi_test] getCurrentGroup promise failed :' + JSON.stringify(error)); console.error('[wifi_test] getCurrentGroup promise failed1 :' + JSON.stringify(error));
expect(true).assertEqual(error !=null); expect(true).assertEqual(error != null);
}); });
}catch(error){ }catch(error){
console.info("[wifi_test]createGroup 5G goBand result : " + JSON.stringify(error.message)); console.info("[wifi_test]createGroup 5G goBand fail : " + JSON.stringify(error.message));
expect(true).assertEqual( (JSON.stringify(error.message)) !=null); expect(true).assertEqual( (JSON.stringify(error.message)) !=null);
} }
done(); done();
...@@ -479,7 +490,7 @@ export default function actsWifiFunctionTest() { ...@@ -479,7 +490,7 @@ export default function actsWifiFunctionTest() {
expect(p2pCancelResult).assertTrue(); expect(p2pCancelResult).assertTrue();
let removeGroupResult = wifi.removeGroup(); let removeGroupResult = wifi.removeGroup();
console.info("[wifi_test]test start removeGroup:" + removeGroupResult); console.info("[wifi_test]test start removeGroup:" + removeGroupResult);
expect(removeGroupResult).assertTrue(); expect(removeGroupResult).assertFalse();
try { try {
await wifi.getCurrentGroup() await wifi.getCurrentGroup()
.then(data => { .then(data => {
...@@ -506,7 +517,7 @@ export default function actsWifiFunctionTest() { ...@@ -506,7 +517,7 @@ export default function actsWifiFunctionTest() {
it('Communication_WiFi_XTS_P2P_0011', 0, async function (done) { it('Communication_WiFi_XTS_P2P_0011', 0, async function (done) {
let removeGroupResult = wifi.removeGroup(10000); let removeGroupResult = wifi.removeGroup(10000);
console.info("[wifi_test]removeGroup(10000) result : " + JSON.stringify(removeGroupResult)); console.info("[wifi_test]removeGroup(10000) result : " + JSON.stringify(removeGroupResult));
expect(removeGroupResult).assertTrue(); expect(removeGroupResult).assertFalse();
try { try {
await wifi.getCurrentGroup() await wifi.getCurrentGroup()
.then(data => { .then(data => {
......
...@@ -53,14 +53,6 @@ function resolveIP(ip) { ...@@ -53,14 +53,6 @@ function resolveIP(ip) {
return (ip>>24 & 0xFF) + "." + (ip>>16 & 0xFF) + "." + (ip>>8 & 0xFF) + "." + (ip & 0xFF); return (ip>>24 & 0xFF) + "." + (ip>>16 & 0xFF) + "." + (ip>>8 & 0xFF) + "." + (ip & 0xFF);
} }
let wifiSecurityType = {
WIFI_SEC_TYPE_INVALID: 0,
WIFI_SEC_TYPE_OPEN: 1,
WIFI_SEC_TYPE_WEP: 2,
WIFI_SEC_TYPE_PSK: 3,
WIFI_SEC_TYPE_SAE: 4,
}
export default function actsWifiCandidateNetWorkTest() { export default function actsWifiCandidateNetWorkTest() {
describe('actsWifiCandidateNetWorkTest', function () { describe('actsWifiCandidateNetWorkTest', function () {
beforeAll(async function (done) { beforeAll(async function (done) {
...@@ -88,7 +80,7 @@ export default function actsWifiCandidateNetWorkTest() { ...@@ -88,7 +80,7 @@ export default function actsWifiCandidateNetWorkTest() {
"bssid": "22:9b:e6:48:1f:5c", "bssid": "22:9b:e6:48:1f:5c",
"preSharedKey": "12345678", "preSharedKey": "12345678",
"isHiddenSsid": false, "isHiddenSsid": false,
"securityType": wifiSecurityType.WIFI_SEC_TYPE_PSK, "securityType": wifi.WifiSecurityType.WIFI_SEC_TYPE_PSK,
}; };
await wifi.addUntrustedConfig(wifiDeviceConfig) await wifi.addUntrustedConfig(wifiDeviceConfig)
.then(ret => { .then(ret => {
...@@ -104,6 +96,19 @@ export default function actsWifiCandidateNetWorkTest() { ...@@ -104,6 +96,19 @@ export default function actsWifiCandidateNetWorkTest() {
}).catch((error) => { }).catch((error) => {
console.error('[wifi_test]removeUntrustedConfig promise failed -> ' + JSON.stringify(error)); console.error('[wifi_test]removeUntrustedConfig promise failed -> ' + JSON.stringify(error));
}); });
let WIFI_SEC_TYPE_INVALID = wifi.WifiSecurityType.WIFI_SEC_TYPE_INVALID;
console.info("[wifi_test]WIFI_SEC_TYPE_INVALID : " + JSON.stringify(WIFI_SEC_TYPE_INVALID));
expect(true).assertEqual( WIFI_SEC_TYPE_INVALID == 0);
let WIFI_SEC_TYPE_OPEN = wifi.WifiSecurityType.WIFI_SEC_TYPE_OPEN;
console.info("[wifi_test]WIFI_SEC_TYPE_OPEN : " + JSON.stringify(WIFI_SEC_TYPE_OPEN));
expect(true).assertEqual( WIFI_SEC_TYPE_OPEN == 1);
let WIFI_SEC_TYPE_WEP = wifi.WifiSecurityType.WIFI_SEC_TYPE_WEP;
console.info("[wifi_test]WIFI_SEC_TYPE_WEP : " + JSON.stringify(WIFI_SEC_TYPE_WEP));
expect(true).assertEqual( WIFI_SEC_TYPE_WEP == 2);
let WIFI_SEC_TYPE_SAE = wifi.WifiSecurityType.WIFI_SEC_TYPE_SAE;
console.info("[wifi_test]WIFI_SEC_TYPE_SAE : " + JSON.stringify(WIFI_SEC_TYPE_SAE));
expect(true).assertEqual( WIFI_SEC_TYPE_SAE == 4);
done(); done();
}) })
...@@ -120,7 +125,7 @@ export default function actsWifiCandidateNetWorkTest() { ...@@ -120,7 +125,7 @@ export default function actsWifiCandidateNetWorkTest() {
"bssid": "22:9b:e6:48:1f:5c", "bssid": "22:9b:e6:48:1f:5c",
"preSharedKey": "12345678", "preSharedKey": "12345678",
"isHiddenSsid": false, "isHiddenSsid": false,
"securityType": wifiSecurityType.WIFI_SEC_TYPE_PSK, "securityType": wifi.WifiSecurityType.WIFI_SEC_TYPE_PSK,
} }
function addCandidate() { function addCandidate() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
......
...@@ -53,15 +53,6 @@ function resolveIP(ip) { ...@@ -53,15 +53,6 @@ function resolveIP(ip) {
return (ip>>24 & 0xFF) + "." + (ip>>16 & 0xFF) + "." + (ip>>8 & 0xFF) + "." + (ip & 0xFF); return (ip>>24 & 0xFF) + "." + (ip>>16 & 0xFF) + "." + (ip>>8 & 0xFF) + "." + (ip & 0xFF);
} }
let wifiSecurityType = {
WIFI_SEC_TYPE_INVALID: 0,
WIFI_SEC_TYPE_EAP: 5,
WIFI_SEC_TYPE_EAP_SUITE_B: 6,
WIFI_SEC_TYPE_OWE:7 ,
WIFI_SEC_TYPE_WAPI_CERT:8 ,
WIFI_SEC_TYPE_WAPI_PSK:9 ,
}
export default function actsWifiManagerCandidateNetWorkTest() { export default function actsWifiManagerCandidateNetWorkTest() {
describe('actsWifiManagerCandidateNetWorkTest', function () { describe('actsWifiManagerCandidateNetWorkTest', function () {
beforeAll(async function (done) { beforeAll(async function (done) {
...@@ -117,6 +108,25 @@ export default function actsWifiManagerCandidateNetWorkTest() { ...@@ -117,6 +108,25 @@ export default function actsWifiManagerCandidateNetWorkTest() {
expect(true).assertEqual( (JSON.stringify(error)) !=null); expect(true).assertEqual( (JSON.stringify(error)) !=null);
}); });
console.info("[wifi_test]wifi get WEP CandidateConfigs result : " + JSON.stringify(getconfig)); console.info("[wifi_test]wifi get WEP CandidateConfigs result : " + JSON.stringify(getconfig));
let WIFI_SEC_TYPE_INVALID = wifiMg.WifiSecurityType.WIFI_SEC_TYPE_INVALID;
console.info("[wifi_test]WIFI_SEC_TYPE_INVALID : " + JSON.stringify(WIFI_SEC_TYPE_INVALID));
expect(true).assertEqual( WIFI_SEC_TYPE_INVALID == 0);
let WIFI_SEC_TYPE_EAP = wifiMg.WifiSecurityType.WIFI_SEC_TYPE_EAP;
console.info("[wifi_test]WIFI_SEC_TYPE_EAP : " + JSON.stringify(WIFI_SEC_TYPE_EAP));
expect(true).assertEqual( WIFI_SEC_TYPE_EAP == 5);
let WIFI_SEC_TYPE_EAP_SUITE_B = wifiMg.WifiSecurityType.WIFI_SEC_TYPE_EAP_SUITE_B;
console.info("[wifi_test]WIFI_SEC_TYPE_EAP_SUITE_B : " + JSON.stringify(WIFI_SEC_TYPE_EAP_SUITE_B));
expect(true).assertEqual( WIFI_SEC_TYPE_EAP_SUITE_B == 6);
let WIFI_SEC_TYPE_OWE = wifiMg.WifiSecurityType.WIFI_SEC_TYPE_OWE;
console.info("[wifi_test]WIFI_SEC_TYPE_OWE : " + JSON.stringify(WIFI_SEC_TYPE_OWE));
expect(true).assertEqual( WIFI_SEC_TYPE_OWE == 7);
let WIFI_SEC_TYPE_WAPI_CERT = wifiMg.WifiSecurityType.WIFI_SEC_TYPE_WAPI_CERT;
console.info("[wifi_test]WIFI_SEC_TYPE_WAPI_CERT : " + JSON.stringify(WIFI_SEC_TYPE_WAPI_CERT));
expect(true).assertEqual( WIFI_SEC_TYPE_WAPI_CERT == 8);
let WIFI_SEC_TYPE_WAPI_PSK = wifiMg.WifiSecurityType.WIFI_SEC_TYPE_WAPI_PSK;
console.info("[wifi_test]WIFI_SEC_TYPE_WAPI_CERT : " + JSON.stringify(WIFI_SEC_TYPE_WAPI_PSK));
expect(true).assertEqual( WIFI_SEC_TYPE_WAPI_PSK == 9);
done(); done();
}) })
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import wifiMg from '@ohos.wifiManager' import wifiMg from '@ohos.wifiManager'
import wifiManagerExt from '@ohos.wifiManagerExt' import wifiManagerExt from '@ohos.wifiManagerExt'
import osaccount from '@ohos.account.osAccount' import osaccount from '@ohos.account.osAccount'
import bundle from '@ohos.bundle' import bundle from '@ohos.bundle'
......
...@@ -53,15 +53,6 @@ function resolveIP(ip) { ...@@ -53,15 +53,6 @@ function resolveIP(ip) {
return (ip>>24 & 0xFF) + "." + (ip>>16 & 0xFF) + "." + (ip>>8 & 0xFF) + "." + (ip & 0xFF); return (ip>>24 & 0xFF) + "." + (ip>>16 & 0xFF) + "." + (ip>>8 & 0xFF) + "." + (ip & 0xFF);
} }
let wifiChannelWidth = {
WIDTH_20MHZ : 0,
WIDTH_40MHZ : 1,
WIDTH_80MHZ : 2,
WIDTH_160MHZ : 3,
WIDTH_80MHZ_PLUS : 4,
WIDTH_INVALID:null,
}
export default function actsWifiManagerFunctionsTest() { export default function actsWifiManagerFunctionsTest() {
describe('actsWifiManagerFunctionsTest', function() { describe('actsWifiManagerFunctionsTest', function() {
beforeAll(async function (done) { beforeAll(async function (done) {
...@@ -139,6 +130,25 @@ export default function actsWifiManagerFunctionsTest() { ...@@ -139,6 +130,25 @@ export default function actsWifiManagerFunctionsTest() {
let countrylenth = getCountryCodeResult.length; let countrylenth = getCountryCodeResult.length;
console.info("[wifi_test]getCountryCode.length :" + JSON.stringify(countrylenth)); console.info("[wifi_test]getCountryCode.length :" + JSON.stringify(countrylenth));
expect(true).assertEqual(countrylenth == 2); expect(true).assertEqual(countrylenth == 2);
let WIDTH_20MHZ = wifiMg.WifiChannelWidth .WIDTH_20MHZ;
console.info("[wifi_test]WIDTH_20MHZ : " + JSON.stringify(WIDTH_20MHZ));
expect(true).assertEqual( WIDTH_20MHZ == 0);
let WIDTH_40MHZ = wifiMg.WifiChannelWidth .WIDTH_40MHZ;
console.info("[wifi_test]WIDTH_40MHZ : " + JSON.stringify(WIDTH_40MHZ));
expect(true).assertEqual( WIDTH_40MHZ == 1);
let WIDTH_80MHZ = wifiMg.WifiChannelWidth .WIDTH_80MHZ;
console.info("[wifi_test]WIDTH_80MHZ : " + JSON.stringify(WIDTH_80MHZ));
expect(true).assertEqual( WIDTH_80MHZ == 2);
let WIDTH_160MHZ = wifiMg.WifiChannelWidth .WIDTH_160MHZ;
console.info("[wifi_test]WIDTH_160MHZ : " + JSON.stringify(WIDTH_160MHZ));
expect(true).assertEqual( WIDTH_160MHZ == 3);
let WIDTH_80MHZ_PLUS = wifiMg.WifiChannelWidth .WIDTH_80MHZ_PLUS;
console.info("[wifi_test]WIDTH_80MHZ_PLUS : " + JSON.stringify(WIDTH_80MHZ_PLUS));
expect(true).assertEqual( WIDTH_80MHZ_PLUS == 4);
let WIDTH_INVALID = wifiMg.WifiChannelWidth .WIDTH_INVALID;
console.info("[wifi_test]WIDTH_INVALID : " + JSON.stringify(WIDTH_INVALID));
expect(true).assertEqual( WIDTH_INVALID == 5);
}) })
/** /**
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import wifi from '@ohos.wifi' import wifi from '@ohos.wifi'
import wifiext from '@ohos.wifiext' import wifiext from '@ohos.wifiext'
import osaccount from '@ohos.account.osAccount' import osaccount from '@ohos.account.osAccount'
import bundle from '@ohos.bundle' import bundle from '@ohos.bundle'
...@@ -54,11 +53,6 @@ function resolveIP(ip) { ...@@ -54,11 +53,6 @@ function resolveIP(ip) {
return (ip>>24 & 0xFF) + "." + (ip>>16 & 0xFF) + "." + (ip>>8 & 0xFF) + "." + (ip & 0xFF); return (ip>>24 & 0xFF) + "." + (ip>>16 & 0xFF) + "." + (ip>>8 & 0xFF) + "." + (ip & 0xFF);
} }
let PowerModel = {
SLEEPING : 0,
GENERAL : 1,
THROUGH_WALL : 2,
}
export default function actsWifiEventTest() { export default function actsWifiEventTest() {
describe('actsWifiEventTest', function() { describe('actsWifiEventTest', function() {
...@@ -362,6 +356,15 @@ export default function actsWifiEventTest() { ...@@ -362,6 +356,15 @@ export default function actsWifiEventTest() {
console.info("SUB_Communication_WiFi_SysCaps_Test_0007 canIUse isAccessToken error: " + e); console.info("SUB_Communication_WiFi_SysCaps_Test_0007 canIUse isAccessToken error: " + e);
} }
console.info('SUB_Communication_WiFi_SysCaps_Test_0007 end'); console.info('SUB_Communication_WiFi_SysCaps_Test_0007 end');
let SLEEPING = wifiext.PowerModel.SLEEPING;
console.info("[wifi_test]SLEEPING : " + JSON.stringify(SLEEPING));
expect(true).assertEqual( SLEEPING == 0);
let GENERAL = wifiext.PowerModel.GENERAL;
console.info("[wifi_test]GENERAL : " + JSON.stringify(GENERAL));
expect(true).assertEqual( GENERAL == 1);
let THROUGH = wifiext.PowerModel.THROUGH_WALL;
console.info("[wifi_test]THROUGH : " + JSON.stringify(THROUGH));
expect(true).assertEqual( THROUGH == 2);
done(); done();
}) })
console.log("*************[wifi_test] start wifi js unit test end*************"); console.log("*************[wifi_test] start wifi js unit test end*************");
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from 'hypium/index' import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test' import testsuite from '../test/List.test'
export default { export default {
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from 'hypium/index' import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test' import testsuite from '../test/List.test'
export default { export default {
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
*/ */
// @ts-nocheck // @ts-nocheck
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import pasteboard from '@ohos.pasteboard' import pasteboard from '@ohos.pasteboard'
export default function pasteBoardJEtsunitTest() { export default function pasteBoardJEtsunitTest() {
...@@ -30,7 +30,7 @@ export default function pasteBoardJEtsunitTest() { ...@@ -30,7 +30,7 @@ export default function pasteBoardJEtsunitTest() {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('pasteboard_function_test1', 0, async function (done) { it('pasteboard_function_test1', 0, async function (done) {
console.info('SUB_pasteBoard_function_JS_API_0100 start') console.info('SUB_pasteBoard_function_JS_API_0100 start');
var systemPasteboard = pasteboard.getSystemPasteboard(); var systemPasteboard = pasteboard.getSystemPasteboard();
systemPasteboard.clear().then(() => { systemPasteboard.clear().then(() => {
...@@ -45,10 +45,10 @@ export default function pasteBoardJEtsunitTest() { ...@@ -45,10 +45,10 @@ export default function pasteBoardJEtsunitTest() {
systemPasteboard.setPasteData(pasteData).then(() => { systemPasteboard.setPasteData(pasteData).then(() => {
console.info('f_test1: systemPasteboard.setPasteData promise'); console.info('f_test1: systemPasteboard.setPasteData promise');
console.info('f_test1: Checks there is content in the pasteboard') console.info('f_test1: Checks there is content in the pasteboard');
systemPasteboard.hasPasteData().then((data) => { systemPasteboard.hasPasteData().then((data) => {
console.info('f_test1: systemPasteboard.hasPasteData promise data = ' + data); console.info('f_test1: systemPasteboard.hasPasteData promise data = ' + data);
expect(data === true || data === false).assertTrue(); expect(data === true ).assertTrue();
var types = pasteData.getMimeTypes(); var types = pasteData.getMimeTypes();
console.info('f_test1: getMimeTypes = ' + types); console.info('f_test1: getMimeTypes = ' + types);
...@@ -62,15 +62,16 @@ export default function pasteBoardJEtsunitTest() { ...@@ -62,15 +62,16 @@ export default function pasteBoardJEtsunitTest() {
expect(pasteData1.getRecordCount() == 1).assertTrue(); expect(pasteData1.getRecordCount() == 1).assertTrue();
console.info('f_test1: Checks the pasteboard content'); console.info('f_test1: Checks the pasteboard content');
var primaryText = pasteData1.getPrimaryText() var primaryText = pasteData1.getPrimaryText();
expect(primaryText == textData).assertTrue;
console.info('f_test1: primaryText = ' + primaryText); console.info('f_test1: primaryText = ' + primaryText);
console.info('Checks pasteboard MAX_RECORD_NUM' + pasteboard.MAX_RECORD_NUM); console.info('Checks pasteboard MAX_RECORD_NUM' + pasteboard.MAX_RECORD_NUM);
expect(pasteboard.MAX_RECORD_NUM == 512).assertTrue(); expect(pasteboard.MAX_RECORD_NUM == 512).assertTrue();
console.info('Checks PasteDataProperty.localOnly') console.info('Checks PasteDataProperty.localOnly');
var pasteDataProperty = pasteData1.getProperty() var pasteDataProperty = pasteData1.getProperty();
console.info('Checks: localOnly = ' + pasteDataProperty.localOnly) console.info('Checks: localOnly = ' + pasteDataProperty.localOnly);
console.info('Checks there is a MIMETYPE_TEXT_PLAIN MIME type of data' + pasteboard.MIMETYPE_TEXT_PLAIN); console.info('Checks there is a MIMETYPE_TEXT_PLAIN MIME type of data' + pasteboard.MIMETYPE_TEXT_PLAIN);
...@@ -78,11 +79,11 @@ export default function pasteBoardJEtsunitTest() { ...@@ -78,11 +79,11 @@ export default function pasteBoardJEtsunitTest() {
console.info('f_test1: SUB_pasteBoard_function_JS_API_0100 end'); console.info('f_test1: SUB_pasteBoard_function_JS_API_0100 end');
done(); done();
}) });
}); });
}); });
}); });
}) });
/** /**
* @tc.number SUB_pasteBoard_function_JS_API_0200 * @tc.number SUB_pasteBoard_function_JS_API_0200
...@@ -93,7 +94,7 @@ export default function pasteBoardJEtsunitTest() { ...@@ -93,7 +94,7 @@ export default function pasteBoardJEtsunitTest() {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('pasteboard_function_test2', 0, async function (done) { it('pasteboard_function_test2', 0, async function (done) {
console.info('f_test2: SUB_pasteBoard_function_JS_API_0200 start') console.info('f_test2: SUB_pasteBoard_function_JS_API_0200 start');
var systemPasteboard = pasteboard.getSystemPasteboard(); var systemPasteboard = pasteboard.getSystemPasteboard();
systemPasteboard.clear().then(() => { systemPasteboard.clear().then(() => {
...@@ -108,26 +109,28 @@ export default function pasteBoardJEtsunitTest() { ...@@ -108,26 +109,28 @@ export default function pasteBoardJEtsunitTest() {
systemPasteboard.setPasteData(pasteData).then(() => { systemPasteboard.setPasteData(pasteData).then(() => {
console.info('f_test2: systemPasteboard.setPasteData promise'); console.info('f_test2: systemPasteboard.setPasteData promise');
console.info('f_test2: Checks there is content in the pasteboard') console.info('f_test2: Checks there is content in the pasteboard');
systemPasteboard.hasPasteData().then((data) => { systemPasteboard.hasPasteData().then((data) => {
console.info('systemPasteboard.hasPasteData promise data = ' + data); console.info('systemPasteboard.hasPasteData promise data = ' + data);
expect(data === true || data === false).assertTrue(); expect(data === true).assertTrue();
console.info('f_test2: Checks the number of records'); console.info('f_test2: Checks the number of records');
systemPasteboard.getPasteData().then((data) => { systemPasteboard.getPasteData().then((data) => {
console.info('f_test2: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); console.info('f_test2: systemPasteboard.getPasteData data = ' + JSON.stringify(data));
var pasteData1 = data; var pasteData1 = data;
var PrimaryText = pasteData1.getPrimaryText();
expect(PrimaryText ==textData ).assertTrue;
var recordCount = pasteData1.getRecordCount(); var recordCount = pasteData1.getRecordCount();
console.info('f_test2: recordCount=' + recordCount); console.info('f_test2: recordCount=' + recordCount);
expect(recordCount == 1).assertTrue(); expect(recordCount == 1).assertTrue();
console.info('SUB_pasteBoard_function_JS_API_0200 end'); console.info('SUB_pasteBoard_function_JS_API_0200 end');
done(); done();
}) });
}); });
}); });
}); });
}) });
/** /**
* @tc.number SUB_pasteBoard_function_JS_API_0300 * @tc.number SUB_pasteBoard_function_JS_API_0300
...@@ -138,7 +141,7 @@ export default function pasteBoardJEtsunitTest() { ...@@ -138,7 +141,7 @@ export default function pasteBoardJEtsunitTest() {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('pasteboard_function_test3', 0, async function (done) { it('pasteboard_function_test3', 0, async function (done) {
console.info('f_test3: SUB_pasteBoard_function_JS_API_0300 start') console.info('f_test3: SUB_pasteBoard_function_JS_API_0300 start');
var systemPasteboard = pasteboard.getSystemPasteboard(); var systemPasteboard = pasteboard.getSystemPasteboard();
systemPasteboard.clear().then(() => { systemPasteboard.clear().then(() => {
...@@ -153,10 +156,10 @@ export default function pasteBoardJEtsunitTest() { ...@@ -153,10 +156,10 @@ export default function pasteBoardJEtsunitTest() {
systemPasteboard.setPasteData(pasteData).then(() => { systemPasteboard.setPasteData(pasteData).then(() => {
console.info('f_test3: systemPasteboard.setPasteData promise'); console.info('f_test3: systemPasteboard.setPasteData promise');
console.info('f_test3: Checks there is content in the pasteboard') console.info('f_test3: Checks there is content in the pasteboard');
systemPasteboard.hasPasteData().then((data) => { systemPasteboard.hasPasteData().then((data) => {
console.info('f_test3: systemPasteboard.hasPasteData promise data = ' + data); console.info('f_test3: systemPasteboard.hasPasteData promise data = ' + data);
expect(data === true || data === false).assertTrue(); expect(data === true ).assertTrue();
console.info('f_test3: Checks the number of records'); console.info('f_test3: Checks the number of records');
systemPasteboard.getPasteData().then((data) => { systemPasteboard.getPasteData().then((data) => {
...@@ -165,20 +168,20 @@ export default function pasteBoardJEtsunitTest() { ...@@ -165,20 +168,20 @@ export default function pasteBoardJEtsunitTest() {
expect(pasteData1.getRecordCount() == 1).assertTrue(); expect(pasteData1.getRecordCount() == 1).assertTrue();
console.info('f_test3: Checks the pasteboard content'); console.info('f_test3: Checks the pasteboard content');
var primaryText = pasteData1.getPrimaryText() var primaryText = pasteData1.getPrimaryText();
expect(primaryText ==textData ).assertTrue;
console.info('f_test3: primaryText = ' + primaryText); console.info('f_test3: primaryText = ' + primaryText);
console.info('Checks there is a MIMETYPE_TEXT_PLAIN MIME type of data' + pasteboard.MIMETYPE_TEXT_PLAIN); console.info('Checks there is a MIMETYPE_TEXT_PLAIN MIME type of data' + pasteboard.MIMETYPE_TEXT_PLAIN);
expect(pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_PLAIN) === true || expect(pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_PLAIN) === true ).assertTrue();
pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_PLAIN) === false).assertTrue();
console.info('SUB_pasteBoard_function_JS_API_0300 end'); console.info('SUB_pasteBoard_function_JS_API_0300 end');
done(); done();
}) });
}); });
}); });
}); });
}) });
/** /**
* @tc.number SUB_pasteBoard_function_JS_API_0400 * @tc.number SUB_pasteBoard_function_JS_API_0400
...@@ -189,16 +192,16 @@ export default function pasteBoardJEtsunitTest() { ...@@ -189,16 +192,16 @@ export default function pasteBoardJEtsunitTest() {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('pasteboard_function_test4', 0, async function (done) { it('pasteboard_function_test4', 0, async function (done) {
console.info('SUB_pasteBoard_function_JS_API_0400 start') console.info('SUB_pasteBoard_function_JS_API_0400 start');
var systemPasteboard = pasteboard.getSystemPasteboard(); var systemPasteboard = pasteboard.getSystemPasteboard();
systemPasteboard.clear().then(() => { systemPasteboard.clear().then(() => {
console.info('f_test4: systemPasteboard.clear promise'); console.info('f_test4: systemPasteboard.clear promise');
var textData = '' var textData = '';
for (var i = 0; i < 300; i++) { for (var i = 0; i < 300; i++) {
textData = textData + "A"; textData = textData + "A";
} };
console.info('f_test4: createPlainTextData textData = ' + textData); console.info('f_test4: createPlainTextData textData = ' + textData);
var pasteData = pasteboard.createPlainTextData(textData); var pasteData = pasteboard.createPlainTextData(textData);
console.info('f_test4: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); console.info('f_test4: createPlainTextData pasteData = ' + JSON.stringify(pasteData));
...@@ -207,10 +210,10 @@ export default function pasteBoardJEtsunitTest() { ...@@ -207,10 +210,10 @@ export default function pasteBoardJEtsunitTest() {
systemPasteboard.setPasteData(pasteData).then(() => { systemPasteboard.setPasteData(pasteData).then(() => {
console.info('f_test4: systemPasteboard.setPasteData promise'); console.info('f_test4: systemPasteboard.setPasteData promise');
console.info('f_test4: Checks there is content in the pasteboard') console.info('f_test4: Checks there is content in the pasteboard');
systemPasteboard.hasPasteData().then((data) => { systemPasteboard.hasPasteData().then((data) => {
console.info('f_test4: systemPasteboard.hasPasteData promise data = ' + data); console.info('f_test4: systemPasteboard.hasPasteData promise data = ' + data);
expect(data === true || data === false).assertTrue(); expect(data === true ).assertTrue();
console.info('f_test4: Checks the number of records'); console.info('f_test4: Checks the number of records');
systemPasteboard.getPasteData().then((data) => { systemPasteboard.getPasteData().then((data) => {
...@@ -219,21 +222,21 @@ export default function pasteBoardJEtsunitTest() { ...@@ -219,21 +222,21 @@ export default function pasteBoardJEtsunitTest() {
expect(pasteData1.getRecordCount() == 1).assertTrue(); expect(pasteData1.getRecordCount() == 1).assertTrue();
console.info('f_test4: Checks the pasteboard content'); console.info('f_test4: Checks the pasteboard content');
var primaryText = pasteData1.getPrimaryText() var primaryText = pasteData1.getPrimaryText();
expect(primaryText ==textData ).assertTrue;
console.info('f_test4: primaryText = ' + primaryText); console.info('f_test4: primaryText = ' + primaryText);
console.info('Checks there is a MIMETYPE_TEXT_PLAIN MIME type of data' + pasteboard.MIMETYPE_TEXT_PLAIN); console.info('Checks there is a MIMETYPE_TEXT_PLAIN MIME type of data' + pasteboard.MIMETYPE_TEXT_PLAIN);
expect(pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_PLAIN) === true || expect(pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_PLAIN) === true ).assertTrue();
pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_PLAIN) === false).assertTrue();
expect(pasteData1.getPrimaryMimeType() == pasteboard.MIMETYPE_TEXT_PLAIN).assertTrue(); expect(pasteData1.getPrimaryMimeType() == pasteboard.MIMETYPE_TEXT_PLAIN).assertTrue();
console.info('f_test4: SUB_pasteBoard_function_JS_API_0400 end'); console.info('f_test4: SUB_pasteBoard_function_JS_API_0400 end');
done(); done();
}) });
}); });
}); });
}); });
}) });
/** /**
* @tc.number SUB_pasteBoard_function_JS_API_0500 * @tc.number SUB_pasteBoard_function_JS_API_0500
...@@ -244,16 +247,16 @@ export default function pasteBoardJEtsunitTest() { ...@@ -244,16 +247,16 @@ export default function pasteBoardJEtsunitTest() {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('pasteboard_function_test5', 0, async function (done) { it('pasteboard_function_test5', 0, async function (done) {
console.info('SUB_pasteBoard_function_JS_API_0500 start') console.info('SUB_pasteBoard_function_JS_API_0500 start');
var systemPasteboard = pasteboard.getSystemPasteboard(); var systemPasteboard = pasteboard.getSystemPasteboard();
systemPasteboard.clear().then(() => { systemPasteboard.clear().then(() => {
console.info('f_test5: systemPasteboard.clear promise'); console.info('f_test5: systemPasteboard.clear promise');
var textData = '' var textData = '';
for (var i = 0; i < 301; i++) { for (var i = 0; i < 301; i++) {
textData = textData + "A"; textData = textData + "A";
} };
console.info('f_test5: createPlainTextData textData = ' + textData); console.info('f_test5: createPlainTextData textData = ' + textData);
var pasteData = pasteboard.createPlainTextData(textData); var pasteData = pasteboard.createPlainTextData(textData);
console.info('f_test5: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); console.info('f_test5: createPlainTextData pasteData = ' + JSON.stringify(pasteData));
...@@ -262,10 +265,10 @@ export default function pasteBoardJEtsunitTest() { ...@@ -262,10 +265,10 @@ export default function pasteBoardJEtsunitTest() {
systemPasteboard.setPasteData(pasteData).then(() => { systemPasteboard.setPasteData(pasteData).then(() => {
console.info('f_test5: systemPasteboard.setPasteData promise'); console.info('f_test5: systemPasteboard.setPasteData promise');
console.info('f_test5: Checks there is content in the pasteboard') console.info('f_test5: Checks there is content in the pasteboard');
systemPasteboard.hasPasteData().then((data) => { systemPasteboard.hasPasteData().then((data) => {
console.info('f_test5: systemPasteboard.hasPasteData promise data = ' + data); console.info('f_test5: systemPasteboard.hasPasteData promise data = ' + data);
expect(data === true || data === false).assertTrue(); expect(data === true ).assertTrue();
console.info('f_test5: Checks the number of records'); console.info('f_test5: Checks the number of records');
systemPasteboard.getPasteData().then((data) => { systemPasteboard.getPasteData().then((data) => {
...@@ -274,20 +277,20 @@ export default function pasteBoardJEtsunitTest() { ...@@ -274,20 +277,20 @@ export default function pasteBoardJEtsunitTest() {
expect(pasteData1.getRecordCount() == 1).assertTrue(); expect(pasteData1.getRecordCount() == 1).assertTrue();
console.info('f_test5: Checks the pasteboard content'); console.info('f_test5: Checks the pasteboard content');
var primaryText = pasteData1.getPrimaryText() var primaryText = pasteData1.getPrimaryText();
expect(primaryText ==textData ).assertTrue;
console.info('f_test5: primaryText = ' + primaryText); console.info('f_test5: primaryText = ' + primaryText);
console.info('Checks there is a MIMETYPE_TEXT_PLAIN MIME type of data' + pasteboard.MIMETYPE_TEXT_PLAIN); console.info('Checks there is a MIMETYPE_TEXT_PLAIN MIME type of data' + pasteboard.MIMETYPE_TEXT_PLAIN);
expect(pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_PLAIN) === true || expect(pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_PLAIN) === true ).assertTrue();
pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_PLAIN) === false).assertTrue();
console.info('SUB_pasteBoard_function_JS_API_0500 end'); console.info('SUB_pasteBoard_function_JS_API_0500 end');
done(); done();
}) });
}); });
}); });
}); });
}) });
/** /**
* @tc.number SUB_pasteBoard_function_JS_API_0600 * @tc.number SUB_pasteBoard_function_JS_API_0600
...@@ -298,13 +301,13 @@ export default function pasteBoardJEtsunitTest() { ...@@ -298,13 +301,13 @@ export default function pasteBoardJEtsunitTest() {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('pasteboard_function_test6', 0, async function (done) { it('pasteboard_function_test6', 0, async function (done) {
console.info('SUB_pasteBoard_function_JS_API_0600 start') console.info('SUB_pasteBoard_function_JS_API_0600 start');
var systemPasteboard = pasteboard.getSystemPasteboard(); var systemPasteboard = pasteboard.getSystemPasteboard();
systemPasteboard.clear().then(() => { systemPasteboard.clear().then(() => {
console.info('f_test6: systemPasteboard.clear promise'); console.info('f_test6: systemPasteboard.clear promise');
var htmlText = '<html><head></head><body>Hello World!</body></html>' var htmlText = '<html><head></head><body>Hello World!</body></html>';
console.info('f_test6: createHtmlData htmlText = ' + htmlText); console.info('f_test6: createHtmlData htmlText = ' + htmlText);
var pasteData = pasteboard.createHtmlData(htmlText); var pasteData = pasteboard.createHtmlData(htmlText);
console.info('f_test6: createHtmlData pasteData = ' + JSON.stringify(pasteData)); console.info('f_test6: createHtmlData pasteData = ' + JSON.stringify(pasteData));
...@@ -313,10 +316,10 @@ export default function pasteBoardJEtsunitTest() { ...@@ -313,10 +316,10 @@ export default function pasteBoardJEtsunitTest() {
systemPasteboard.setPasteData(pasteData).then(() => { systemPasteboard.setPasteData(pasteData).then(() => {
console.info('f_test6: systemPasteboard.setPasteData promise'); console.info('f_test6: systemPasteboard.setPasteData promise');
console.info('f_test6: Checks there is content in the pasteboard') console.info('f_test6: Checks there is content in the pasteboard');
systemPasteboard.hasPasteData().then((data) => { systemPasteboard.hasPasteData().then((data) => {
console.info('f_test6: systemPasteboard.hasPasteData promise data = ' + data); console.info('f_test6: systemPasteboard.hasPasteData promise data = ' + data);
expect(data === true || data === false).assertTrue(); expect(data === true ).assertTrue();
console.info('f_test6: Checks the number of records'); console.info('f_test6: Checks the number of records');
systemPasteboard.getPasteData().then((data) => { systemPasteboard.getPasteData().then((data) => {
...@@ -325,22 +328,21 @@ export default function pasteBoardJEtsunitTest() { ...@@ -325,22 +328,21 @@ export default function pasteBoardJEtsunitTest() {
expect(pasteData1.getRecordCount() == 1).assertTrue(); expect(pasteData1.getRecordCount() == 1).assertTrue();
console.info('f_test6: Checks the pasteboard content'); console.info('f_test6: Checks the pasteboard content');
var primaryHtml = pasteData1.getPrimaryHtml() var primaryHtml = pasteData1.getPrimaryHtml();
console.info('f_test6: getPrimaryHtml = ' + primaryHtml); console.info('f_test6: getPrimaryHtml = ' + primaryHtml);
expect(primaryHtml == htmlText).assertTrue(); expect(primaryHtml == htmlText).assertTrue();
console.info('Checks there is a MIMETYPE_TEXT_HTML MIME type of data' + pasteboard.MIMETYPE_TEXT_HTML); console.info('Checks there is a MIMETYPE_TEXT_HTML MIME type of data' + pasteboard.MIMETYPE_TEXT_HTML);
expect(pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_HTML) === true || expect(pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_HTML) === true ).assertTrue();
pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_HTML) === false).assertTrue();
console.info('f_test6: getPrimaryMimeType = ' + pasteData1.getPrimaryMimeType()); console.info('f_test6: getPrimaryMimeType = ' + pasteData1.getPrimaryMimeType());
console.info('SUB_pasteBoard_function_JS_API_0600 end'); console.info('SUB_pasteBoard_function_JS_API_0600 end');
done(); done();
}) });
}); });
}); });
}); });
}) });
/** /**
* @tc.number SUB_pasteBoard_function_JS_API_0700 * @tc.number SUB_pasteBoard_function_JS_API_0700
...@@ -351,13 +353,13 @@ export default function pasteBoardJEtsunitTest() { ...@@ -351,13 +353,13 @@ export default function pasteBoardJEtsunitTest() {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('pasteboard_function_test7', 0, async function (done) { it('pasteboard_function_test7', 0, async function (done) {
console.info('f_test7: SUB_pasteBoard_function_JS_API_0700 start') console.info('f_test7: SUB_pasteBoard_function_JS_API_0700 start');
var systemPasteboard = pasteboard.getSystemPasteboard(); var systemPasteboard = pasteboard.getSystemPasteboard();
systemPasteboard.clear().then(() => { systemPasteboard.clear().then(() => {
console.info('f_test7: systemPasteboard.clear promise'); console.info('f_test7: systemPasteboard.clear promise');
var htmlText = '' var htmlText = '';
console.info('f_test7: createHtmlData htmlText = ' + htmlText); console.info('f_test7: createHtmlData htmlText = ' + htmlText);
var pasteData = pasteboard.createHtmlData(htmlText); var pasteData = pasteboard.createHtmlData(htmlText);
console.info('f_test7: createHtmlData pasteData = ' + JSON.stringify(pasteData)); console.info('f_test7: createHtmlData pasteData = ' + JSON.stringify(pasteData));
...@@ -366,24 +368,27 @@ export default function pasteBoardJEtsunitTest() { ...@@ -366,24 +368,27 @@ export default function pasteBoardJEtsunitTest() {
systemPasteboard.setPasteData(pasteData).then(() => { systemPasteboard.setPasteData(pasteData).then(() => {
console.info('f_test7: systemPasteboard.setPasteData promise'); console.info('f_test7: systemPasteboard.setPasteData promise');
console.info('f_test7: Checks there is content in the pasteboard') console.info('f_test7: Checks there is content in the pasteboard');
systemPasteboard.hasPasteData().then((data) => { systemPasteboard.hasPasteData().then((data) => {
console.info('systemPasteboard.hasPasteData promise data = ' + data); console.info('systemPasteboard.hasPasteData promise data = ' + data);
expect(data === true || data === false).assertTrue(); expect(data === true ).assertTrue();
console.info('f_test7: Checks the number of records'); console.info('f_test7: Checks the number of records');
systemPasteboard.getPasteData().then((data) => { systemPasteboard.getPasteData().then((data) => {
console.info('f_test7: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); console.info('f_test7: systemPasteboard.getPasteData data = ' + JSON.stringify(data));
var pasteData1 = data; var pasteData1 = data;
var primaryHtml = pasteData1.getPrimaryHtml();
console.info('f_test7: getPrimaryHtml = ' + primaryHtml);
expect(primaryHtml == htmlText).assertTrue();
expect(pasteData1.getRecordCount() == 1).assertTrue(); expect(pasteData1.getRecordCount() == 1).assertTrue();
console.info('SUB_pasteBoard_function_JS_API_0700 end'); console.info('SUB_pasteBoard_function_JS_API_0700 end');
done(); done();
}) });
}); });
}); });
}); });
}) });
/** /**
* @tc.number SUB_pasteBoard_function_JS_API_0800 * @tc.number SUB_pasteBoard_function_JS_API_0800
...@@ -394,13 +399,13 @@ export default function pasteBoardJEtsunitTest() { ...@@ -394,13 +399,13 @@ export default function pasteBoardJEtsunitTest() {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('pasteboard_function_test8', 0, async function (done) { it('pasteboard_function_test8', 0, async function (done) {
console.info('SUB_pasteBoard_function_JS_API_0800 start') console.info('SUB_pasteBoard_function_JS_API_0800 start');
var systemPasteboard = pasteboard.getSystemPasteboard(); var systemPasteboard = pasteboard.getSystemPasteboard();
systemPasteboard.clear().then(() => { systemPasteboard.clear().then(() => {
console.info('f_test8: systemPasteboard.clear promise'); console.info('f_test8: systemPasteboard.clear promise');
var htmlText = 'Hello 中国!@#$%^&*()_+{}\?.' var htmlText = 'Hello 中国!@#$%^&*()_+{}\?.';
console.info('f_test8: createHtmlData htmlText = ' + htmlText); console.info('f_test8: createHtmlData htmlText = ' + htmlText);
var pasteData = pasteboard.createHtmlData(htmlText); var pasteData = pasteboard.createHtmlData(htmlText);
console.info('f_test8: createHtmlData pasteData = ' + JSON.stringify(pasteData)); console.info('f_test8: createHtmlData pasteData = ' + JSON.stringify(pasteData));
...@@ -409,28 +414,28 @@ export default function pasteBoardJEtsunitTest() { ...@@ -409,28 +414,28 @@ export default function pasteBoardJEtsunitTest() {
systemPasteboard.setPasteData(pasteData).then(() => { systemPasteboard.setPasteData(pasteData).then(() => {
console.info('f_test8: systemPasteboard.setPasteData promise'); console.info('f_test8: systemPasteboard.setPasteData promise');
console.info('f_test8: Checks there is content in the pasteboard') console.info('f_test8: Checks there is content in the pasteboard');
systemPasteboard.hasPasteData().then((data) => { systemPasteboard.hasPasteData().then((data) => {
console.info('f_test8: systemPasteboard.hasPasteData promise data = ' + data); console.info('f_test8: systemPasteboard.hasPasteData promise data = ' + data);
expect(data === true || data === false).assertTrue(); expect(data === true ).assertTrue();
console.info('f_test8: Checks the number of records'); console.info('f_test8: Checks the number of records');
systemPasteboard.getPasteData().then((data) => { systemPasteboard.getPasteData().then((data) => {
console.info('f_test8: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); console.info('f_test8: systemPasteboard.getPasteData data = ' + JSON.stringify(data));
var pasteData1 = data; var pasteData1 = data;
expect(pasteData1.getPrimaryHtml() == htmlText).assertTrue();
expect(pasteData1.getRecordCount() == 1).assertTrue(); expect(pasteData1.getRecordCount() == 1).assertTrue();
console.info('Checks there is a MIMETYPE_TEXT_HTML MIME type of data' + pasteboard.MIMETYPE_TEXT_HTML); console.info('Checks there is a MIMETYPE_TEXT_HTML MIME type of data' + pasteboard.MIMETYPE_TEXT_HTML);
expect(pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_HTML) === true || expect(pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_HTML) === true ).assertTrue();
pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_HTML) === false).assertTrue();
console.info('SUB_pasteBoard_function_JS_API_0800 end'); console.info('SUB_pasteBoard_function_JS_API_0800 end');
done(); done();
}) });
}); });
}); });
}); });
}) });
/** /**
* @tc.number SUB_pasteBoard_function_JS_API_0900 * @tc.number SUB_pasteBoard_function_JS_API_0900
...@@ -441,13 +446,13 @@ export default function pasteBoardJEtsunitTest() { ...@@ -441,13 +446,13 @@ export default function pasteBoardJEtsunitTest() {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('pasteboard_function_test9', 0, async function (done) { it('pasteboard_function_test9', 0, async function (done) {
console.info('SUB_pasteBoard_function_JS_API_0900 start') console.info('SUB_pasteBoard_function_JS_API_0900 start');
var systemPasteboard = pasteboard.getSystemPasteboard(); var systemPasteboard = pasteboard.getSystemPasteboard();
systemPasteboard.clear().then(() => { systemPasteboard.clear().then(() => {
console.info('f_test9: systemPasteboard.clear promise'); console.info('f_test9: systemPasteboard.clear promise');
var uriText = 'https://www.baidu.com/' var uriText = 'https://www.baidu.com/';
console.info('f_test9: createUriData uriText = ' + uriText); console.info('f_test9: createUriData uriText = ' + uriText);
var pasteData = pasteboard.createUriData(uriText); var pasteData = pasteboard.createUriData(uriText);
console.info('f_test9: createUriData pasteData = ' + JSON.stringify(pasteData)); console.info('f_test9: createUriData pasteData = ' + JSON.stringify(pasteData));
...@@ -456,10 +461,10 @@ export default function pasteBoardJEtsunitTest() { ...@@ -456,10 +461,10 @@ export default function pasteBoardJEtsunitTest() {
systemPasteboard.setPasteData(pasteData).then(() => { systemPasteboard.setPasteData(pasteData).then(() => {
console.info('f_test9: systemPasteboard.setPasteData promise'); console.info('f_test9: systemPasteboard.setPasteData promise');
console.info('f_test9: Checks there is content in the pasteboard') console.info('f_test9: Checks there is content in the pasteboard');
systemPasteboard.hasPasteData().then((data) => { systemPasteboard.hasPasteData().then((data) => {
console.info('f_test9: systemPasteboard.hasPasteData promise data = ' + data); console.info('f_test9: systemPasteboard.hasPasteData promise data = ' + data);
expect(data === true || data === false).assertTrue(); expect(data === true ).assertTrue();
console.info('f_test9: Checks the number of records'); console.info('f_test9: Checks the number of records');
systemPasteboard.getPasteData().then((data) => { systemPasteboard.getPasteData().then((data) => {
...@@ -468,21 +473,20 @@ export default function pasteBoardJEtsunitTest() { ...@@ -468,21 +473,20 @@ export default function pasteBoardJEtsunitTest() {
expect(pasteData1.getRecordCount() == 1).assertTrue(); expect(pasteData1.getRecordCount() == 1).assertTrue();
console.info('f_test9: Checks the pasteboard content'); console.info('f_test9: Checks the pasteboard content');
var primaryUri = pasteData1.getPrimaryUri() var primaryUri = pasteData1.getPrimaryUri();
console.info('f_test9: getPrimaryUri = ' + primaryUri); console.info('f_test9: getPrimaryUri = ' + primaryUri);
expect(primaryUri == uriText).assertTrue(); expect(primaryUri == uriText).assertTrue();
console.info('Checks there is a MIMETYPE_TEXT_URI MIME type of data' + pasteboard.MIMETYPE_TEXT_URI); console.info('Checks there is a MIMETYPE_TEXT_URI MIME type of data' + pasteboard.MIMETYPE_TEXT_URI);
expect(pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_URI) === true || expect(pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_URI) === true ).assertTrue();
pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_URI) === false).assertTrue();
console.info('SUB_pasteBoard_function_JS_API_0900 end'); console.info('SUB_pasteBoard_function_JS_API_0900 end');
done(); done();
}) });
}); });
}); });
}); });
}) });
/** /**
* @tc.number SUB_pasteBoard_function_JS_API_1000 * @tc.number SUB_pasteBoard_function_JS_API_1000
...@@ -493,13 +497,13 @@ export default function pasteBoardJEtsunitTest() { ...@@ -493,13 +497,13 @@ export default function pasteBoardJEtsunitTest() {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('pasteboard_function_test10', 0, async function (done) { it('pasteboard_function_test10', 0, async function (done) {
console.info('SUB_pasteBoard_function_JS_API_1000 start') console.info('SUB_pasteBoard_function_JS_API_1000 start');
var systemPasteboard = pasteboard.getSystemPasteboard(); var systemPasteboard = pasteboard.getSystemPasteboard();
systemPasteboard.clear().then(() => { systemPasteboard.clear().then(() => {
console.info('f_test10: systemPasteboard.clear promise'); console.info('f_test10: systemPasteboard.clear promise');
var uriText = '' var uriText = '';
console.info('f_test10: createUriData uriText = ' + uriText); console.info('f_test10: createUriData uriText = ' + uriText);
var pasteData = pasteboard.createUriData(uriText); var pasteData = pasteboard.createUriData(uriText);
console.info('f_test10: createUriData pasteData = ' + JSON.stringify(pasteData)); console.info('f_test10: createUriData pasteData = ' + JSON.stringify(pasteData));
...@@ -508,24 +512,25 @@ export default function pasteBoardJEtsunitTest() { ...@@ -508,24 +512,25 @@ export default function pasteBoardJEtsunitTest() {
systemPasteboard.setPasteData(pasteData).then(() => { systemPasteboard.setPasteData(pasteData).then(() => {
console.info('f_test10: systemPasteboard.setPasteData promise'); console.info('f_test10: systemPasteboard.setPasteData promise');
console.info('f_test10: Checks there is content in the pasteboard') console.info('f_test10: Checks there is content in the pasteboard');
systemPasteboard.hasPasteData().then((data) => { systemPasteboard.hasPasteData().then((data) => {
console.info('f_test10: systemPasteboard.hasPasteData promise data = ' + data); console.info('f_test10: systemPasteboard.hasPasteData promise data = ' + data);
expect(data === true || data === false).assertTrue(); expect(data === true ).assertTrue();
console.info('f_test10: Checks the number of records'); console.info('f_test10: Checks the number of records');
systemPasteboard.getPasteData().then((data) => { systemPasteboard.getPasteData().then((data) => {
console.info('f_test10: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); console.info('f_test10: systemPasteboard.getPasteData data = ' + JSON.stringify(data));
var pasteData1 = data; var pasteData1 = data;
expect(pasteData1.getPrimaryUri() == uriText).assertTrue();
expect(pasteData1.getRecordCount() == 1).assertTrue(); expect(pasteData1.getRecordCount() == 1).assertTrue();
console.info('SUB_pasteBoard_function_JS_API_1000 end'); console.info('SUB_pasteBoard_function_JS_API_1000 end');
done(); done();
}) });
}); });
}); });
}); });
}) });
/** /**
* @tc.number SUB_pasteBoard_function_JS_API_1100 * @tc.number SUB_pasteBoard_function_JS_API_1100
...@@ -536,13 +541,13 @@ export default function pasteBoardJEtsunitTest() { ...@@ -536,13 +541,13 @@ export default function pasteBoardJEtsunitTest() {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('pasteboard_function_test11', 0, async function (done) { it('pasteboard_function_test11', 0, async function (done) {
console.info('SUB_pasteBoard_function_JS_API_1100 start') console.info('SUB_pasteBoard_function_JS_API_1100 start');
var systemPasteboard = pasteboard.getSystemPasteboard(); var systemPasteboard = pasteboard.getSystemPasteboard();
systemPasteboard.clear().then(() => { systemPasteboard.clear().then(() => {
console.info('f_test11: systemPasteboard.clear promise'); console.info('f_test11: systemPasteboard.clear promise');
var uriText = 'Hello//' var uriText = 'Hello//';
console.info('f_test11: createUriData uriText = ' + uriText); console.info('f_test11: createUriData uriText = ' + uriText);
var pasteData = pasteboard.createUriData(uriText); var pasteData = pasteboard.createUriData(uriText);
console.info('f_test11: createUriData pasteData = ' + JSON.stringify(pasteData)); console.info('f_test11: createUriData pasteData = ' + JSON.stringify(pasteData));
...@@ -551,28 +556,28 @@ export default function pasteBoardJEtsunitTest() { ...@@ -551,28 +556,28 @@ export default function pasteBoardJEtsunitTest() {
systemPasteboard.setPasteData(pasteData).then(() => { systemPasteboard.setPasteData(pasteData).then(() => {
console.info('f_test11: systemPasteboard.setPasteData promise'); console.info('f_test11: systemPasteboard.setPasteData promise');
console.info('f_test11: Checks there is content in the pasteboard') console.info('f_test11: Checks there is content in the pasteboard');
systemPasteboard.hasPasteData().then((data) => { systemPasteboard.hasPasteData().then((data) => {
console.info('f_test11: systemPasteboard.hasPasteData promise data = ' + data); console.info('f_test11: systemPasteboard.hasPasteData promise data = ' + data);
expect(data === true || data === false).assertTrue(); expect(data === true ).assertTrue();
console.info('f_test11: Checks the number of records'); console.info('f_test11: Checks the number of records');
systemPasteboard.getPasteData().then((data) => { systemPasteboard.getPasteData().then((data) => {
console.info('f_test11: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); console.info('f_test11: systemPasteboard.getPasteData data = ' + JSON.stringify(data));
var pasteData1 = data; var pasteData1 = data;
expect(pasteData1.getPrimaryUri() == uriText).assertTrue();
expect(pasteData1.getRecordCount() == 1).assertTrue(); expect(pasteData1.getRecordCount() == 1).assertTrue();
console.info('Checks there is a MIMETYPE_TEXT_URI MIME type of data' + pasteboard.MIMETYPE_TEXT_URI); console.info('Checks there is a MIMETYPE_TEXT_URI MIME type of data' + pasteboard.MIMETYPE_TEXT_URI);
expect(pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_URI) === true || expect(pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_URI) === true).assertTrue();
pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_URI) === false).assertTrue();
console.info('SUB_pasteBoard_function_JS_API_1100 end'); console.info('SUB_pasteBoard_function_JS_API_1100 end');
done(); done();
}) });
}); });
}); });
}); });
}) });
/** /**
* @tc.number SUB_pasteBoard_function_JS_API_1200 * @tc.number SUB_pasteBoard_function_JS_API_1200
...@@ -583,7 +588,7 @@ export default function pasteBoardJEtsunitTest() { ...@@ -583,7 +588,7 @@ export default function pasteBoardJEtsunitTest() {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('pasteboard_function_test12', 0, async function (done) { it('pasteboard_function_test12', 0, async function (done) {
console.info('SUB_pasteBoard_function_JS_API_1200 start') console.info('SUB_pasteBoard_function_JS_API_1200 start');
var systemPasteboard = pasteboard.getSystemPasteboard(); var systemPasteboard = pasteboard.getSystemPasteboard();
systemPasteboard.clear().then(() => { systemPasteboard.clear().then(() => {
...@@ -592,7 +597,7 @@ export default function pasteBoardJEtsunitTest() { ...@@ -592,7 +597,7 @@ export default function pasteBoardJEtsunitTest() {
var want = { var want = {
bundleName: "com.example.myapplication8", bundleName: "com.example.myapplication8",
abilityName: "com.example.myapplication8.MainAbility" abilityName: "com.example.myapplication8.MainAbility"
} };
console.info('f_test12: createWantData want.bundleName = ' + want.bundleName); console.info('f_test12: createWantData want.bundleName = ' + want.bundleName);
console.info('f_test12: createWantData want.bundleName = ' + want.abilityName); console.info('f_test12: createWantData want.bundleName = ' + want.abilityName);
...@@ -2078,7 +2083,7 @@ export default function pasteBoardJEtsunitTest() { ...@@ -2078,7 +2083,7 @@ export default function pasteBoardJEtsunitTest() {
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('pasteboard_function_test39', 0, async function (done) { it('pasteboard_function_test39', 0, async function (done) {
console.info('SUB_pasteBoard_function_JS_API_3900 start') console.info('SUB_pasteBoard_function_JS_API_3900 start')
var systemPasteboard = pasteboard.getSystemPasteboard(); var systemPasteboard = pasteboard.getSystemPasteboard();
...@@ -2108,12 +2113,32 @@ export default function pasteBoardJEtsunitTest() { ...@@ -2108,12 +2113,32 @@ export default function pasteBoardJEtsunitTest() {
console.info('f_test39: Sets the Property') console.info('f_test39: Sets the Property')
var pasteDataProperty = pasteData1.getProperty() var pasteDataProperty = pasteData1.getProperty()
console.info('f_test39: timestamp = ' + pasteDataProperty.timestamp) console.info('f_test39: timestamp = ' + pasteDataProperty.timestamp)
pasteDataProperty.additions["one"] = "Hello" let object = {
bundleName: "pasteBoardJEtsunitTest"
};
pasteDataProperty.additions["one"] = object;
pasteDataProperty.shareOption = 1;
pasteData1.setProperty(pasteDataProperty);
console.info('f_test39: Checks the Property') console.info('f_test39: Checks the Property')
var pasteDataProperty1 = pasteData1.getProperty() systemPasteboard.setPasteData(pasteData1).then(() => {
console.info('f_test39: timestamp = ' + pasteDataProperty1.timestamp) systemPasteboard.hasPasteData().then((data) => {
console.info('f_test39: additions = ' + pasteDataProperty1.additions["one"]) expect(data == true).assertTrue();
systemPasteboard.getPasteData().then((data) => {
var pasteData2 = data;
var pasteDataProperty1 = pasteData2.getProperty();
expect(pasteDataProperty1.shareOption == 1).assertTrue();
console.info('f_test39: timestamp = ' + pasteDataProperty1.timestamp);
console.info('f_test39: shareOption = ' + pasteDataProperty1.shareOption);
let tag1 = pasteData1.getTag();
console.info('f_test39: gettag = ' + tag1);
console.info('f_test39: additions = ' + pasteDataProperty1.additions["one"])
console.info('SUB_pasteBoard_function_JS_API_3900 end');
done();
});
});
});
console.info('SUB_pasteBoard_function_JS_API_3900 end'); console.info('SUB_pasteBoard_function_JS_API_3900 end');
done(); done();
...@@ -2132,7 +2157,7 @@ export default function pasteBoardJEtsunitTest() { ...@@ -2132,7 +2157,7 @@ export default function pasteBoardJEtsunitTest() {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('pasteboard_function_test40', 0, async function (done) { it('pasteboard_function_test40', 0, async function (done) {
console.info('SUB_pasteBoard_function_JS_API_4000 start') console.info('SUB_pasteBoard_function_JS_API_4000 start');
var systemPasteboard = pasteboard.getSystemPasteboard(); var systemPasteboard = pasteboard.getSystemPasteboard();
systemPasteboard.clear().then(() => { systemPasteboard.clear().then(() => {
...@@ -2147,10 +2172,10 @@ export default function pasteBoardJEtsunitTest() { ...@@ -2147,10 +2172,10 @@ export default function pasteBoardJEtsunitTest() {
systemPasteboard.setPasteData(pasteData).then(() => { systemPasteboard.setPasteData(pasteData).then(() => {
console.info('f_test40: systemPasteboard.setPasteData promise'); console.info('f_test40: systemPasteboard.setPasteData promise');
console.info('f_test40: Checks there is content in the pasteboard') console.info('f_test40: Checks there is content in the pasteboard');
systemPasteboard.hasPasteData().then((data) => { systemPasteboard.hasPasteData().then((data) => {
console.info('f_test40: systemPasteboard.hasPasteData promise data = ' + data); console.info('f_test40: systemPasteboard.hasPasteData promise data = ' + data);
expect(data === true || data === false).assertTrue(); expect(data === true).assertTrue();
console.info('f_test40: Checks the number of records'); console.info('f_test40: Checks the number of records');
systemPasteboard.getPasteData().then((data) => { systemPasteboard.getPasteData().then((data) => {
...@@ -2158,26 +2183,37 @@ export default function pasteBoardJEtsunitTest() { ...@@ -2158,26 +2183,37 @@ export default function pasteBoardJEtsunitTest() {
var pasteData1 = data; var pasteData1 = data;
expect(pasteData1.getRecordCount() == 1).assertTrue(); expect(pasteData1.getRecordCount() == 1).assertTrue();
console.info('f_test40: Sets the Property') console.info('f_test40: Sets the Property');
var pasteDataProperty = pasteData1.getProperty() var pasteDataProperty = pasteData1.getProperty();
console.info('f_test40: timestamp = ' + pasteDataProperty.timestamp) console.info('f_test40: timestamp = ' + pasteDataProperty.timestamp);
pasteDataProperty.additions["one"] = "Hello" pasteDataProperty.tag = "Test";
pasteDataProperty.tag = "Test" pasteData1.setProperty(pasteDataProperty);
console.info('f_test40: Checks the Property') systemPasteboard.setPasteData(pasteData1).then(() => {
var pasteDataProperty1 = pasteData1.getProperty() console.info('Succeeded in setting PasteData.');
console.info('f_test40: timestamp = ' + pasteDataProperty1.timestamp) systemPasteboard.hasPasteData().then((data) => {
console.info('f_test40: additions = ' + pasteDataProperty1.additions["one"]) console.info(`Succeeded in checking the PasteData. Data: ${data}`);
console.info('f_test40: tag = ' + pasteDataProperty1.tag)
console.info('f_test40: getTag = ' + pasteData1.getTag()) expect(data == true).assertTrue();
systemPasteboard.getPasteData().then((data) => {
console.info('SUB_pasteBoard_function_JS_API_4000 end'); var pasteData2 = data;
done(); var pasteDataProperty1 = pasteData2.getProperty();
}) expect(pasteDataProperty1.tag = "Test").assertTrue();
console.info('f_test40: timestamp = ' + pasteDataProperty1.timestamp);
console.info('f_test40: tag = ' + pasteDataProperty1.tag);
console.info('SUB_pasteBoard_function_JS_API_4000 end');
done();
}).catch((err) => {
console.info("getPasteData error,error: " + err)
})
});
});
});
}); });
}); });
}); });
}) });
/** /**
* @tc.number SUB_pasteBoard_function_JS_API_4100 * @tc.number SUB_pasteBoard_function_JS_API_4100
...@@ -2188,7 +2224,7 @@ export default function pasteBoardJEtsunitTest() { ...@@ -2188,7 +2224,7 @@ export default function pasteBoardJEtsunitTest() {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('pasteboard_function_test41', 0, async function (done) { it('pasteboard_function_test41', 0, async function (done) {
console.info('SUB_pasteBoard_function_JS_API_4100 start') console.info('SUB_pasteBoard_function_JS_API_4100 start');
var systemPasteboard = pasteboard.getSystemPasteboard(); var systemPasteboard = pasteboard.getSystemPasteboard();
systemPasteboard.clear().then(() => { systemPasteboard.clear().then(() => {
...@@ -2203,10 +2239,10 @@ export default function pasteBoardJEtsunitTest() { ...@@ -2203,10 +2239,10 @@ export default function pasteBoardJEtsunitTest() {
systemPasteboard.setPasteData(pasteData).then(() => { systemPasteboard.setPasteData(pasteData).then(() => {
console.info('f_test41: systemPasteboard.setPasteData promise'); console.info('f_test41: systemPasteboard.setPasteData promise');
console.info('f_test41: Checks there is content in the pasteboard') console.info('f_test41: Checks there is content in the pasteboard');
systemPasteboard.hasPasteData().then((data) => { systemPasteboard.hasPasteData().then((data) => {
console.info('f_test41: systemPasteboard.hasPasteData promise data = ' + data); console.info('f_test41: systemPasteboard.hasPasteData promise data = ' + data);
expect(data === true || data === false).assertTrue(); expect(data === true ).assertTrue();
console.info('f_test41: Checks the number of records'); console.info('f_test41: Checks the number of records');
systemPasteboard.getPasteData().then((data) => { systemPasteboard.getPasteData().then((data) => {
...@@ -2214,21 +2250,22 @@ export default function pasteBoardJEtsunitTest() { ...@@ -2214,21 +2250,22 @@ export default function pasteBoardJEtsunitTest() {
var pasteData1 = data; var pasteData1 = data;
expect(pasteData1.getRecordCount() == 1).assertTrue(); expect(pasteData1.getRecordCount() == 1).assertTrue();
console.info('f_test41: Clears the pasteBoard') console.info('f_test41: Clears the pasteBoard');
systemPasteboard.clear() systemPasteboard.clear();
console.info('f_test41: Checks the Property') console.info('f_test41: Checks the Property');
var pasteDataProperty1 = pasteData1.getProperty() var pasteDataProperty1 = pasteData1.getProperty();
console.info('f_test41: timestamp = ' + pasteDataProperty1.timestamp) expect(pasteDataProperty1.tag == "").assertTrue();
console.info('f_test41: tag = ' + pasteDataProperty1.tag) console.info('f_test41: timestamp = ' + pasteDataProperty1.timestamp);
console.info('f_test41: tag = ' + pasteDataProperty1.tag);
console.info('SUB_pasteBoard_function_JS_API_4100 end'); console.info('SUB_pasteBoard_function_JS_API_4100 end');
done(); done();
}) });
}); });
}); });
}); });
}) });
/** /**
* @tc.number SUB_pasteBoard_function_JS_API_4200 * @tc.number SUB_pasteBoard_function_JS_API_4200
......
/* /*
* Copyright (C) 2022 Huawei Device Co., Ltd. * Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License'); * Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -35,19 +35,20 @@ export default function pasteBoardSystemPasteBoardTest(){ ...@@ -35,19 +35,20 @@ export default function pasteBoardSystemPasteBoardTest(){
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 2 * @tc.level : Level 2
*/ */
it('SUB_PASTEBOARD_FUNCTION_ETS_CLEARDATA_CALLBACK_0100', 0, async function (done) { it('SUB_PASTEBOARD_FUNCTION_ETS_CLEARDATA_CALLBACK_0100', 0, async function (done) {
console.info("SUB_PASTEBOARD_FUNCTION_ETS_CLEARDATA_CALLBACK_0100 start") console.info("SUB_PASTEBOARD_FUNCTION_ETS_CLEARDATA_CALLBACK_0100 start")
let pasteData = pasteboard.createData('string', ARRAY_BUFFER); let pasteData = pasteboard.createData('string', ARRAY_BUFFER);
let systemPasteBoard = pasteboard.getSystemPasteboard(); let systemPasteBoard = pasteboard.getSystemPasteboard();
await systemPasteBoard.setData(pasteData) await systemPasteBoard.setData(pasteData)
await systemPasteBoard.clearData(async (err, data) => { await systemPasteBoard.clearData(async (err, data) => {
console.info("Clear the data in the system pasteBoard finished") console.info("Clear the data in the system pasteBoard finished")
})
await systemPasteBoard.hasData().then((data) => { await systemPasteBoard.hasData().then((data) => {
console.info(`Succeeded in checking the PasteData. Data: ${data}`);
expect(data).assertEqual(false); expect(data).assertEqual(false);
done();
console.info("SUB_PASTEBOARD_FUNCTION_ETS_CLEARDATA_CALLBACK_0100 end")
}) })
done(); })
console.info("SUB_PASTEBOARD_FUNCTION_ETS_CLEARDATA_CALLBACK_0100 end")
}) })
/** /**
......
...@@ -1204,7 +1204,7 @@ describe('intlTest', function () { ...@@ -1204,7 +1204,7 @@ describe('intlTest', function () {
let numfmt = new Intl.NumberFormat('en-CN', { style: 'percent', maximumFractionDigits: 2, let numfmt = new Intl.NumberFormat('en-CN', { style: 'percent', maximumFractionDigits: 2,
minimumIntegerDigits: 7 }); minimumIntegerDigits: 7 });
console.log('formatNumber_test_2300 ' + numfmt.format(123456.789)); console.log('formatNumber_test_2300 ' + numfmt.format(123456.789));
expect(numfmt.format(123456.789)).assertEqual('0,123,456.79%'); expect(numfmt.format(123456.789)).assertEqual('12,345,678.9%');
}) })
/* * /* *
......
...@@ -45,7 +45,7 @@ async function changedLocationMode(){ ...@@ -45,7 +45,7 @@ async function changedLocationMode(){
console.info('[lbs_js] getLocationSwitchState result: ' + JSON.stringify(result1)); console.info('[lbs_js] getLocationSwitchState result: ' + JSON.stringify(result1));
if(!result1){ if(!result1){
await geolocation.requestEnableLocation().then(async(result) => { await geolocation.requestEnableLocation().then(async(result) => {
await sleep(3000); await sleep(1000);
console.info('[lbs_js] test requestEnableLocation promise result: ' + JSON.stringify(result)); console.info('[lbs_js] test requestEnableLocation promise result: ' + JSON.stringify(result));
}).catch((error) => { }).catch((error) => {
console.info("[lbs_js] promise then error." + JSON.stringify(error)); console.info("[lbs_js] promise then error." + JSON.stringify(error));
...@@ -116,11 +116,12 @@ export default function geolocationTest_geo5() { ...@@ -116,11 +116,12 @@ export default function geolocationTest_geo5() {
expect(true).assertEqual(JSON.stringify(geocoder1) != null); expect(true).assertEqual(JSON.stringify(geocoder1) != null);
} catch (error) { } catch (error) {
console.info('[lbs_js] isGeocoderAvailable err:' + JSON.stringify(error)); console.info('[lbs_js] isGeocoderAvailable err:' + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); console.info('[lbs_js] not support now');
expect(error.code).assertEqual("801");
} }
}); });
/** /**
* @tc.number SUB_HSS_LocationSystem_Geo_2000 * @tc.number SUB_HSS_LocationSystem_Geo_2000
* @tc.name TestgetAddressesFromLocation * @tc.name TestgetAddressesFromLocation
* @tc.desc Address Resolution Test. * @tc.desc Address Resolution Test.
...@@ -130,11 +131,12 @@ export default function geolocationTest_geo5() { ...@@ -130,11 +131,12 @@ export default function geolocationTest_geo5() {
*/ */
it('SUB_HSS_LocationSystem_Geo_2000', 0, async function (done) { it('SUB_HSS_LocationSystem_Geo_2000', 0, async function (done) {
try { try {
let reverseGeocodeRequest = { "latitude": 31.265496, "longitude": 121.62771, "maxItems": 1, "locale": "zh" }; let reverseGeocodeRequest = { "latitude": 31.265496, "longitude": 121.62771, "maxItems": 1 };
geolocationm.getAddressesFromLocation(reverseGeocodeRequest, (err, data) => { geolocationm.getAddressesFromLocation(reverseGeocodeRequest, (err, data) => {
if (err) { if (err) {
console.info('[lbs_js] getAddressesFromLocation4 callback err is:' + JSON.stringify(err)); console.info('[lbs_js] getAddressesFromLocation4 callback err is:' + JSON.stringify(err));
return; console.info('[lbs_js] not support now');
expect(err.code).assertEqual(801);
} else { } else {
console.info("[lbs_js] getAddressesFromLocation4 callback data is:" + JSON.stringify(data)); console.info("[lbs_js] getAddressesFromLocation4 callback data is:" + JSON.stringify(data));
expect(true).assertEqual((JSON.stringify(data)) != null); expect(true).assertEqual((JSON.stringify(data)) != null);
...@@ -142,12 +144,13 @@ export default function geolocationTest_geo5() { ...@@ -142,12 +144,13 @@ export default function geolocationTest_geo5() {
}); });
} catch (error) { } catch (error) {
console.info("[lbs_js] getAddressesFromLocation4 callback try error:"+ error); console.info("[lbs_js] getAddressesFromLocation4 callback try error:"+ error);
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(2000); await sleep(2000);
done(); done();
}) })
/** /**
* @tc.number SUB_HSS_LocationSystem_Geo_2100 * @tc.number SUB_HSS_LocationSystem_Geo_2100
* @tc.name TestgetAddressesFromLocation * @tc.name TestgetAddressesFromLocation
...@@ -158,7 +161,7 @@ export default function geolocationTest_geo5() { ...@@ -158,7 +161,7 @@ export default function geolocationTest_geo5() {
*/ */
it('SUB_HSS_LocationSystem_Geo_2100', 0, async function (done) { it('SUB_HSS_LocationSystem_Geo_2100', 0, async function (done) {
try { try {
let reverseGeocodeRequest = { "latitude": 31.265496, "longitude": 121.62771, "maxItems": 1 }; let reverseGeocodeRequest = { "latitude": 31.265496, "longitude": 121.62771, "maxItems": 5};
await geolocationm.getAddressesFromLocation(reverseGeocodeRequest).then((data) => { await geolocationm.getAddressesFromLocation(reverseGeocodeRequest).then((data) => {
console.info('[lbs_js] getAddressesFromLocation21 promise: ' + JSON.stringify(data)); console.info('[lbs_js] getAddressesFromLocation21 promise: ' + JSON.stringify(data));
console.info('addressUrl: ' + JSON.stringify(data)[0].addressUrl console.info('addressUrl: ' + JSON.stringify(data)[0].addressUrl
...@@ -175,12 +178,13 @@ export default function geolocationTest_geo5() { ...@@ -175,12 +178,13 @@ export default function geolocationTest_geo5() {
}).catch(error => { }).catch(error => {
console.info("[lbs_js] getAddressesFromLocation21 promise then error." + JSON.stringify(error)); console.info("[lbs_js] getAddressesFromLocation21 promise then error." + JSON.stringify(error));
console.info('[lbs_js] not support now'); console.info('[lbs_js] not support now');
expect(true).assertEqual(JSON.stringify(error) != null); expect(error.code).assertEqual(801);
}); });
} catch (error) { } catch (error) {
console.info("[lbs_js] getAddressesFromLocation21 try err." + JSON.stringify(error)); console.info("[lbs_js] getAddressesFromLocation21 try err." + JSON.stringify(error));
expect(true).assertEqual((JSON.stringify(error.message)) != null); expect(true).assertFalse();
} }
await sleep(1000);
done(); done();
}) })
...@@ -201,12 +205,13 @@ export default function geolocationTest_geo5() { ...@@ -201,12 +205,13 @@ export default function geolocationTest_geo5() {
}).catch((error) => { }).catch((error) => {
console.info("[lbs_js] getAddressesFromLocation22 promise then error." + JSON.stringify(error)); console.info("[lbs_js] getAddressesFromLocation22 promise then error." + JSON.stringify(error));
console.info('[lbs_js] not support now'); console.info('[lbs_js] not support now');
expect(true).assertEqual(JSON.stringify(error) != null); expect(error.code).assertEqual(801);
}); });
} catch (error) { } catch (error) {
console.info("[lbs_js] getAddressesFromLocation22 try err." + JSON.stringify(error)); console.info("[lbs_js] getAddressesFromLocation22 try err." + JSON.stringify(error));
expect(true).assertEqual((JSON.stringify(error.message)) != null); expect(true).assertFalse();
} }
await sleep(1000);
done(); done();
}) })
...@@ -226,12 +231,12 @@ export default function geolocationTest_geo5() { ...@@ -226,12 +231,12 @@ export default function geolocationTest_geo5() {
expect(true).assertEqual((JSON.stringify(data)) != null); expect(true).assertEqual((JSON.stringify(data)) != null);
}).catch(error => { }).catch(error => {
console.info("[lbs_js] getAddressesFromLocation2301 promise then error." + JSON.stringify(error)); console.info("[lbs_js] getAddressesFromLocation2301 promise then error." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null);
console.info('[lbs_js] not support now'); console.info('[lbs_js] not support now');
expect(error.code).assertEqual(801);
}); });
} catch (error) { } catch (error) {
console.info("[lbs_js] getAddressesFromLocation message." + JSON.stringify(error.message)); console.info("[lbs_js] getAddressesFromLocation message." + JSON.stringify(error));
expect(true).assertEqual((JSON.stringify(error.message)) != null); expect(true).assertFalse();
} }
let reverseGeocodeRequest2 = { "latitude": 90.1, "longitude": 121.62771, "maxItems": 1 }; let reverseGeocodeRequest2 = { "latitude": 90.1, "longitude": 121.62771, "maxItems": 1 };
try { try {
...@@ -240,11 +245,11 @@ export default function geolocationTest_geo5() { ...@@ -240,11 +245,11 @@ export default function geolocationTest_geo5() {
expect(data.length).assertEqual(0); expect(data.length).assertEqual(0);
}).catch(error => { }).catch(error => {
console.info("[lbs_js] getAddressesFromLocation2302 promise then error." + JSON.stringify(error)); console.info("[lbs_js] getAddressesFromLocation2302 promise then error." + JSON.stringify(error));
expect(true).assertEqual((JSON.stringify(error)) != null); expect(true).assertFalse();
}); });
} catch (error) { } catch (error) {
console.info("[lbs_js] getAddressesFromLocation message." + JSON.stringify(error.message)); console.info("[lbs_js] getAddressesFromLocation message." + JSON.stringify(error));
expect(true).assertEqual((JSON.stringify(error.message)) != null); expect(error.code).assertEqual("401");
} }
let reverseGeocodeRequest3 = { "latitude": -90, "longitude": 121.62771, "maxItems": 1 }; let reverseGeocodeRequest3 = { "latitude": -90, "longitude": 121.62771, "maxItems": 1 };
try { try {
...@@ -254,25 +259,26 @@ export default function geolocationTest_geo5() { ...@@ -254,25 +259,26 @@ export default function geolocationTest_geo5() {
}).catch(error => { }).catch(error => {
console.info("[lbs_js] getAddressesFromLocation2303 promise then error." + JSON.stringify(error)); console.info("[lbs_js] getAddressesFromLocation2303 promise then error." + JSON.stringify(error));
console.info('[lbs_js] not support now'); console.info('[lbs_js] not support now');
expect(true).assertEqual(JSON.stringify(error) != null); expect(error.code).assertEqual(801);
}); });
} catch (error) { } catch (error) {
console.info("[lbs_js] getAddressesFromLocation message." + JSON.stringify(error.message)); console.info("[lbs_js] getAddressesFromLocation message." + JSON.stringify(error));
expect(true).assertEqual((JSON.stringify(error.message)) != null); expect(true).assertFalse();
} }
let reverseGeocodeRequest4 = { "latitude": -90.1, "longitude": 121.62771, "maxItems": 1 }; let reverseGeocodeRequest4 = { "latitude": -90.1, "longitude": 121.62771, "maxItems": 1 };
try { try {
await geolocationm.getAddressesFromLocation(reverseGeocodeRequest4).then((data) => { await geolocationm.getAddressesFromLocation(reverseGeocodeRequest4).then((data) => {
console.info('[lbs_js] getAddressesFromLocation2304 promise: ' + JSON.stringify(data)); console.info('[lbs_js] getAddressesFromLocation2304 promise: ' + JSON.stringify(data));
expect(data.length).assertEqual(0); expect(true).assertEqual((JSON.stringify(data)) != null);
}).catch(error => { }).catch(error => {
console.info("[lbs_js] getAddressesFromLocation2304 promise then error." + JSON.stringify(error)); console.info("[lbs_js] getAddressesFromLocation2304 promise then error." + JSON.stringify(error));
expect(true).assertEqual((JSON.stringify(error)) != null); expect(true).assertFalse();
}); });
} catch (error) { } catch (error) {
console.info("[lbs_js] getAddressesFromLocation message." + JSON.stringify(error.message)); console.info("[lbs_js] getAddressesFromLocation message." + JSON.stringify(error));
expect(true).assertEqual((JSON.stringify(error.message)) != null); expect(error.code).assertEqual("401");
} }
await sleep(1000);
done(); done();
}) })
...@@ -293,12 +299,13 @@ export default function geolocationTest_geo5() { ...@@ -293,12 +299,13 @@ export default function geolocationTest_geo5() {
}).catch(error => { }).catch(error => {
console.info("[lbs_js] getAddressesFromLocation2401 promise then error." + JSON.stringify(error)); console.info("[lbs_js] getAddressesFromLocation2401 promise then error." + JSON.stringify(error));
console.info('[lbs_js] not support now'); console.info('[lbs_js] not support now');
expect(true).assertEqual(JSON.stringify(error) != null); expect(error.code).assertEqual(801);
}); });
} catch (error) { } catch (error) {
console.info("[lbs_js] getAddressesFromLocation message." + JSON.stringify(error.message)); console.info("[lbs_js] getAddressesFromLocation message." + JSON.stringify(error));
expect(true).assertEqual((JSON.stringify(error.message)) != null); expect(true).assertFalse();
} }
await sleep(1000);
let reverseGeocodeRequest1 = { "latitude": 31.265496, "longitude": -180.1, "maxItems": 1 }; let reverseGeocodeRequest1 = { "latitude": 31.265496, "longitude": -180.1, "maxItems": 1 };
try { try {
await geolocationm.getAddressesFromLocation(reverseGeocodeRequest1).then((data) => { await geolocationm.getAddressesFromLocation(reverseGeocodeRequest1).then((data) => {
...@@ -306,12 +313,13 @@ export default function geolocationTest_geo5() { ...@@ -306,12 +313,13 @@ export default function geolocationTest_geo5() {
expect(data.length).assertEqual(0); expect(data.length).assertEqual(0);
}).catch(error => { }).catch(error => {
console.info("[lbs_js] getAddressesFromLocation2402 promise then error." + JSON.stringify(error)); console.info("[lbs_js] getAddressesFromLocation2402 promise then error." + JSON.stringify(error));
expect(true).assertEqual((JSON.stringify(error)) != null); expect(true).assertFalse();
}); });
} catch (error) { } catch (error) {
console.info("[lbs_js] getAddressesFromLocation message." + JSON.stringify(error.message)); console.info("[lbs_js] getAddressesFromLocation message." + JSON.stringify(error));
expect(true).assertEqual((JSON.stringify(error.message)) != null); expect(true).assertEqual((JSON.stringify(error.message)) != null);
} }
await sleep(1000);
let reverseGeocodeRequest2 = { "latitude": 31.265496, "longitude": 180, "maxItems": 1 }; let reverseGeocodeRequest2 = { "latitude": 31.265496, "longitude": 180, "maxItems": 1 };
try { try {
await geolocationm.getAddressesFromLocation(reverseGeocodeRequest2).then((data) => { await geolocationm.getAddressesFromLocation(reverseGeocodeRequest2).then((data) => {
...@@ -320,12 +328,13 @@ export default function geolocationTest_geo5() { ...@@ -320,12 +328,13 @@ export default function geolocationTest_geo5() {
}).catch(error => { }).catch(error => {
console.info("[lbs_js] getAddressesFromLocation2403 promise then error." + JSON.stringify(error)); console.info("[lbs_js] getAddressesFromLocation2403 promise then error." + JSON.stringify(error));
console.info('[lbs_js] not support now'); console.info('[lbs_js] not support now');
expect(true).assertEqual(JSON.stringify(error) != null); expect(error.code).assertEqual(801);
}); });
} catch (error) { } catch (error) {
console.info("[lbs_js] getAddressesFromLocation message." + JSON.stringify(error.message)); console.info("[lbs_js] getAddressesFromLocation message." + JSON.stringify(error));
expect(true).assertEqual((JSON.stringify(error.message)) != null); expect(true).assertFalse();
} }
await sleep(1000);
let reverseGeocodeRequest3 = { "latitude": 31.265496, "longitude": 180.1, "maxItems": 1 }; let reverseGeocodeRequest3 = { "latitude": 31.265496, "longitude": 180.1, "maxItems": 1 };
try { try {
await geolocationm.getAddressesFromLocation(reverseGeocodeRequest3).then((data) => { await geolocationm.getAddressesFromLocation(reverseGeocodeRequest3).then((data) => {
...@@ -333,12 +342,13 @@ export default function geolocationTest_geo5() { ...@@ -333,12 +342,13 @@ export default function geolocationTest_geo5() {
expect(data.length).assertEqual(0); expect(data.length).assertEqual(0);
}).catch(error => { }).catch(error => {
console.info("[lbs_js] getAddressesFromLocation2404 promise then error." + JSON.stringify(error)); console.info("[lbs_js] getAddressesFromLocation2404 promise then error." + JSON.stringify(error));
expect(true).assertEqual((JSON.stringify(error)) != null); expect(true).assertFalse();
}); });
} catch (error) { } catch (error) {
console.info("[lbs_js] getAddressesFromLocation message." + JSON.stringify(error.message)); console.info("[lbs_js] getAddressesFromLocation message." + JSON.stringify(error));
expect(true).assertEqual((JSON.stringify(error.message)) != null); expect(true).assertEqual((JSON.stringify(error.message)) != null);
} }
await sleep(1000);
done(); done();
}) })
...@@ -356,10 +366,6 @@ export default function geolocationTest_geo5() { ...@@ -356,10 +366,6 @@ export default function geolocationTest_geo5() {
"description": "上海市浦东新区金穗路1800号", "description": "上海市浦东新区金穗路1800号",
"maxItems": 1, "maxItems": 1,
"locale": "zh", "locale": "zh",
"minLatitude": "",
"minLongitude": "",
"maxLatitude": "",
"maxLongitude": ""
}; };
try { try {
geolocationm.getAddressesFromLocationName(geocodeRequest, (err, data) => { geolocationm.getAddressesFromLocationName(geocodeRequest, (err, data) => {
...@@ -397,14 +403,14 @@ export default function geolocationTest_geo5() { ...@@ -397,14 +403,14 @@ export default function geolocationTest_geo5() {
} }
} else { } else {
console.info("[lbs_js] getAddressesFromLocationName08 callback data is: " + JSON.stringify(data)); console.info("[lbs_js] getAddressesFromLocationName08 callback data is: " + JSON.stringify(data));
expect(true).assertEqual((JSON.stringify(data)) != null);
} }
done(); done();
}); });
}catch(error){ }catch(error){
console.info("[lbs_js] getAddressesFromLocationName08 message." + JSON.stringify(error.message)); console.info("[lbs_js] getAddressesFromLocationName08 message." + JSON.stringify(error.message));
expect(true).assertEqual((JSON.stringify(error.message)) != null); expect(true).assertFalse();
} }
await sleep(1000);
done(); done();
}) })
...@@ -417,19 +423,21 @@ export default function geolocationTest_geo5() { ...@@ -417,19 +423,21 @@ export default function geolocationTest_geo5() {
* @tc.level Level 2 * @tc.level Level 2
*/ */
it('SUB_HSS_LocationSystem_Geo_2600', 0, async function (done) { it('SUB_HSS_LocationSystem_Geo_2600', 0, async function (done) {
let geocodeRequest = { "description": "上海市浦东新区金穗路1800号", "maxItems": 1 }; let geocodeRequest = { "description": "上海市浦东新区金穗路1800号", "maxItems": 3 };
try { try {
await geolocationm.getAddressesFromLocationName(geocodeRequest).then((result) => { await geolocationm.getAddressesFromLocationName(geocodeRequest).then((result) => {
console.info("[lbs_js] getAddressesFromLocation09 callback data is:" + JSON.stringify(result)); console.info("[lbs_js] getAddressesFromLocation09 callback data is:" + JSON.stringify(result));
expect(true).assertEqual((JSON.stringify(result)) != null); expect(true).assertEqual((JSON.stringify(result)) != null);
}).catch((error) => { }).catch((error) => {
console.info("[lbs_js] getAddressesFromLocationName09 promise then error." + JSON.stringify(error)); console.info("[lbs_js] getAddressesFromLocationName09 promise then error." + JSON.stringify(error));
expect(true).assertEqual((JSON.stringify(error)) != null); console.info('[lbs_js] not support now');
expect(error.code).assertEqual(801);
}); });
} catch (error) { } catch (error) {
console.info("[lbs_js] getAddressesFromLocationName26 try err." + JSON.stringify(error)); console.info("[lbs_js] getAddressesFromLocationName26 try err." + JSON.stringify(error));
expect(true).assertEqual((JSON.stringify(error.message)) != null); expect(true).assertFalse();
} }
await sleep(1000);
done(); done();
}) })
...@@ -450,12 +458,13 @@ export default function geolocationTest_geo5() { ...@@ -450,12 +458,13 @@ export default function geolocationTest_geo5() {
}).catch((error) => { }).catch((error) => {
console.info("[lbs_js] getAddressesFromLocationName10 promise then error." + JSON.stringify(error)); console.info("[lbs_js] getAddressesFromLocationName10 promise then error." + JSON.stringify(error));
console.info('[lbs_js] not support now'); console.info('[lbs_js] not support now');
expect(true).assertEqual(JSON.stringify(error) != null); expect(error.code).assertEqual(801);
}); });
} catch (error) { } catch (error) {
console.info("[lbs_js] getAddressesFromLocationName27 try err." + JSON.stringify(error)); console.info("[lbs_js] getAddressesFromLocationName27 try err." + JSON.stringify(error));
expect(true).assertEqual((JSON.stringify(error.message)) != null); expect(true).assertFalse();
} }
await sleep(1000);
done(); done();
}) })
...@@ -466,6 +475,7 @@ export default function geolocationTest_geo5() { ...@@ -466,6 +475,7 @@ export default function geolocationTest_geo5() {
* @tc.size MEDIUM * @tc.size MEDIUM
* @tc.type Function * @tc.type Function
* @tc.level Level 2 * @tc.level Level 2
需要实测!!!!
*/ */
it('SUB_HSS_LocationSystem_Geo_2800', 0, async function (done) { it('SUB_HSS_LocationSystem_Geo_2800', 0, async function (done) {
try { try {
...@@ -475,13 +485,13 @@ export default function geolocationTest_geo5() { ...@@ -475,13 +485,13 @@ export default function geolocationTest_geo5() {
expect(true).assertEqual((JSON.stringify(result)) != null); expect(true).assertEqual((JSON.stringify(result)) != null);
}).catch((error) => { }).catch((error) => {
console.info("[lbs_js] getAddressesFromLocationName111 promise then error." + JSON.stringify(error)); console.info("[lbs_js] getAddressesFromLocationName111 promise then error." + JSON.stringify(error));
console.info('[lbs_js] not support now'); expect(true).assertFalse();
expect(true).assertEqual(JSON.stringify(error) != null);
}); });
}catch(error){ }catch(error){
console.info("[lbs_js] getAddressesFromLocationName111 message." + JSON.stringify(error.message)); console.info("[lbs_js] getAddressesFromLocationName111 message." + JSON.stringify(error.message));
expect(true).assertEqual((JSON.stringify(error.message)) != null); expect(error.code).assertEqual("401");
} }
await sleep(1000);
let geocodeRequest1 = { "description": null, "maxItems": 1 }; let geocodeRequest1 = { "description": null, "maxItems": 1 };
try { try {
await geolocationm.getAddressesFromLocationName(geocodeRequest1).then((result) => { await geolocationm.getAddressesFromLocationName(geocodeRequest1).then((result) => {
...@@ -489,12 +499,13 @@ export default function geolocationTest_geo5() { ...@@ -489,12 +499,13 @@ export default function geolocationTest_geo5() {
expect(result.length == 0).assertTrue(); expect(result.length == 0).assertTrue();
}).catch((error) => { }).catch((error) => {
console.info("[lbs_js] getAddressesFromLocationName112 promise then error." + JSON.stringify(error)); console.info("[lbs_js] getAddressesFromLocationName112 promise then error." + JSON.stringify(error));
expect(true).assertEqual((JSON.stringify(error)) != null); expect(true).assertFalse();
}); });
}catch(error){ }catch(error){
console.info("[lbs_js] getAddressesFromLocationName112 message." + JSON.stringify(error.message)); console.info("[lbs_js] getAddressesFromLocationName112 message." + JSON.stringify(error.message));
expect(true).assertEqual((JSON.stringify(error.message)) != null); expect(error.code).assertEqual("401");
} }
await sleep(1000);
done(); done();
}) })
...@@ -522,12 +533,13 @@ export default function geolocationTest_geo5() { ...@@ -522,12 +533,13 @@ export default function geolocationTest_geo5() {
}).catch((error) => { }).catch((error) => {
console.info("[lbs_js] getAddressesFromLocationName29 promise then error." + JSON.stringify(error)); console.info("[lbs_js] getAddressesFromLocationName29 promise then error." + JSON.stringify(error));
console.info('[lbs_js] not support now'); console.info('[lbs_js] not support now');
expect(true).assertEqual(JSON.stringify(error) != null); expect(error.code).assertEqual(801);
}); });
} catch (error) { } catch (error) {
console.info("[lbs_js] getAddressesFromLocationName29 try err." + JSON.stringify(error)); console.info("[lbs_js] getAddressesFromLocationName29 try err." + JSON.stringify(error));
expect(true).assertEqual((JSON.stringify(error.message)) != null); expect(true).assertFalse();
} }
await sleep(1000);
done(); done();
}) })
...@@ -555,12 +567,13 @@ export default function geolocationTest_geo5() { ...@@ -555,12 +567,13 @@ export default function geolocationTest_geo5() {
expect(result.length == 0).assertTrue(); expect(result.length == 0).assertTrue();
}).catch((error) => { }).catch((error) => {
console.info("[lbs_js] getAddressesFromLocationName301 promise then error." + JSON.stringify(error)); console.info("[lbs_js] getAddressesFromLocationName301 promise then error." + JSON.stringify(error));
expect(true).assertEqual((JSON.stringify(error)) != null); expect(true).assertFalse();
}); });
}catch(error){ }catch(error){
console.info("[lbs_js] getAddressesFromLocationName301 message." + JSON.stringify(error.message)); console.info("[lbs_js] getAddressesFromLocationName301 message." + JSON.stringify(error.message));
expect(true).assertEqual((JSON.stringify(error.message)) != null); expect(error.code).assertEqual("401");
} }
await sleep(1000);
let geocodeRequest1 = { let geocodeRequest1 = {
"description": null, "description": null,
"maxItems": 1, "maxItems": 1,
...@@ -575,12 +588,14 @@ export default function geolocationTest_geo5() { ...@@ -575,12 +588,14 @@ export default function geolocationTest_geo5() {
expect(result.length == 0).assertTrue(); expect(result.length == 0).assertTrue();
}).catch((error) => { }).catch((error) => {
console.info("[lbs_js] getAddressesFromLocationName302 promise then error." + JSON.stringify(error)); console.info("[lbs_js] getAddressesFromLocationName302 promise then error." + JSON.stringify(error));
expect(true).assertEqual((JSON.stringify(error)) != null); expect(true).assertFalse();
}); });
}catch(error){ }catch(error){
console.info("[lbs_js] getAddressesFromLocationName302 message." + JSON.stringify(error.message)); console.info("[lbs_js] getAddressesFromLocationName302 message." + JSON.stringify(error.message));
expect(true).assertEqual((JSON.stringify(error.message)) != null); expect(error.code).assertEqual("401");
} }
await sleep(1000);
done(); done();
}) })
...@@ -608,13 +623,13 @@ export default function geolocationTest_geo5() { ...@@ -608,13 +623,13 @@ export default function geolocationTest_geo5() {
expect(result.length >= 0).assertTrue(); expect(result.length >= 0).assertTrue();
}).catch((error) => { }).catch((error) => {
console.info("[lbs_js] getAddressesFromLocationName31 promise then error." + JSON.stringify(error)); console.info("[lbs_js] getAddressesFromLocationName31 promise then error." + JSON.stringify(error));
console.info('[lbs_js] not support now'); expect(error.code).assertEqual(801);
expect(true).assertEqual(JSON.stringify(error) != null);
}); });
} catch (error) { } catch (error) {
console.info("[lbs_js] getAddressesFromLocationName31 message." + JSON.stringify(error)); console.info("[lbs_js] getAddressesFromLocationName31 message." + JSON.stringify(error));
expect(true).assertEqual((JSON.stringify(error.message)) != null); expect(error.code).assertEqual("401");
} }
await sleep(1000);
done(); done();
}) })
...@@ -643,12 +658,13 @@ export default function geolocationTest_geo5() { ...@@ -643,12 +658,13 @@ export default function geolocationTest_geo5() {
}).catch((error) => { }).catch((error) => {
console.info("[lbs_js] getAddressesFromLocationName32 promise then error." + JSON.stringify(error)); console.info("[lbs_js] getAddressesFromLocationName32 promise then error." + JSON.stringify(error));
console.info('[lbs_js] not support now'); console.info('[lbs_js] not support now');
expect(true).assertEqual(JSON.stringify(error) != null); expect(error.code).assertEqual(801);
}); });
} catch (error) { } catch (error) {
console.info("[lbs_js] getAddressesFromLocationName32 message." + JSON.stringify(error)); console.info("[lbs_js] getAddressesFromLocationName32 message." + JSON.stringify(error));
expect(true).assertEqual((JSON.stringify(error.message)) != null); expect(error.code).assertEqual("401");
} }
await sleep(1000);
done(); done();
}) })
...@@ -676,12 +692,13 @@ export default function geolocationTest_geo5() { ...@@ -676,12 +692,13 @@ export default function geolocationTest_geo5() {
}).catch((error) => { }).catch((error) => {
console.info("[lbs_js] getAddressesFromLocationName33 promise1 then error." + JSON.stringify(error)); console.info("[lbs_js] getAddressesFromLocationName33 promise1 then error." + JSON.stringify(error));
console.info('[lbs_js] not support now'); console.info('[lbs_js] not support now');
expect(true).assertEqual(JSON.stringify(error) != null); expect(error.code).assertEqual(801);
}); });
}catch(error){ }catch(error){
console.info("[lbs_js] getAddressesFromLocationName33 message1." + JSON.stringify(error.message)); console.info("[lbs_js] getAddressesFromLocationName33 message1." + JSON.stringify(error.message));
expect(true).assertEqual((JSON.stringify(error.message)) != null); expect(true).assertFalse();
} }
await sleep(1000);
let geocodeRequest2 = { let geocodeRequest2 = {
"description": "上海金穗路1800号", "description": "上海金穗路1800号",
"maxItems": 1, "maxItems": 1,
...@@ -697,12 +714,13 @@ export default function geolocationTest_geo5() { ...@@ -697,12 +714,13 @@ export default function geolocationTest_geo5() {
}).catch((error) => { }).catch((error) => {
console.info("[lbs_js] getAddressesFromLocationName33 promise2 then error." + JSON.stringify(error)); console.info("[lbs_js] getAddressesFromLocationName33 promise2 then error." + JSON.stringify(error));
console.info('[lbs_js] not support now'); console.info('[lbs_js] not support now');
expect(true).assertEqual(JSON.stringify(error) != null); expect(error.code).assertEqual(801);
}); });
}catch(error){ }catch(error){
console.info("[lbs_js] getAddressesFromLocationName33 message2." + JSON.stringify(error.message)); console.info("[lbs_js] getAddressesFromLocationName33 message2." + JSON.stringify(error.message));
expect(true).assertEqual((JSON.stringify(error.message)) != null); expect(true).assertFalse();
} }
await sleep(1000);
let geocodeRequest3 = { let geocodeRequest3 = {
"description": "上海金穗路1800号", "description": "上海金穗路1800号",
"maxItems": 1, "maxItems": 1,
...@@ -717,12 +735,13 @@ export default function geolocationTest_geo5() { ...@@ -717,12 +735,13 @@ export default function geolocationTest_geo5() {
expect(true).assertEqual((JSON.stringify(result)) == null); expect(true).assertEqual((JSON.stringify(result)) == null);
}).catch((error) => { }).catch((error) => {
console.info("[lbs_js] getAddressesFromLocationName33 promise3 then error." + JSON.stringify(error)); console.info("[lbs_js] getAddressesFromLocationName33 promise3 then error." + JSON.stringify(error));
expect(true).assertEqual((JSON.stringify(error)) != null); expect(true).assertFalse();
}); });
}catch(error){ }catch(error){
console.info("[lbs_js] getAddressesFromLocationName33 message3." + JSON.stringify(error.message)); console.info("[lbs_js] getAddressesFromLocationName33 message3." + JSON.stringify(error.message));
expect(true).assertEqual((JSON.stringify(error.message)) != null); expect(error.code).assertEqual("401");
} }
await sleep(1000);
let geocodeRequest4 = { let geocodeRequest4 = {
"description": "上海金穗路1800号", "description": "上海金穗路1800号",
"maxItems": 1, "maxItems": 1,
...@@ -738,12 +757,13 @@ export default function geolocationTest_geo5() { ...@@ -738,12 +757,13 @@ export default function geolocationTest_geo5() {
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertEqual(JSON.stringify(error) != null);
}).catch((error) => { }).catch((error) => {
console.info("[lbs_js] getAddressesFromLocationName33 promise4 then error." + JSON.stringify(error)); console.info("[lbs_js] getAddressesFromLocationName33 promise4 then error." + JSON.stringify(error));
expect(true).assertEqual((JSON.stringify(error)) != null); expect(true).assertFalse();
}); });
}catch(error){ }catch(error){
console.info("[lbs_js] getAddressesFromLocationName33 message4." + JSON.stringify(error.message)); console.info("[lbs_js] getAddressesFromLocationName33 message4." + JSON.stringify(error.message));
expect(true).assertEqual((JSON.stringify(error.message)) != null); expect(error.code).assertEqual("401");
} }
await sleep(1000);
let geocodeRequest5 = { let geocodeRequest5 = {
"description": "上海金穗路1800号", "description": "上海金穗路1800号",
"maxItems": 1, "maxItems": 1,
...@@ -759,12 +779,13 @@ export default function geolocationTest_geo5() { ...@@ -759,12 +779,13 @@ export default function geolocationTest_geo5() {
}).catch((error) => { }).catch((error) => {
console.info("[lbs_js] getAddressesFromLocationName33 promise5 then error." + JSON.stringify(error)); console.info("[lbs_js] getAddressesFromLocationName33 promise5 then error." + JSON.stringify(error));
console.info('[lbs_js] not support now'); console.info('[lbs_js] not support now');
expect(true).assertEqual(JSON.stringify(error) != null); expect(error.code).assertEqual(801);
}); });
}catch(error){ }catch(error){
console.info("[lbs_js] getAddressesFromLocationName33 message5." + JSON.stringify(error.message)); console.info("[lbs_js] getAddressesFromLocationName33 message5." + JSON.stringify(error.message));
expect(true).assertEqual((JSON.stringify(error.message)) != null); expect(true).assertFalse();
} }
await sleep(1000);
let geocodeRequest6 = { let geocodeRequest6 = {
"description": "上海金穗路1800号", "description": "上海金穗路1800号",
"maxItems": 1, "maxItems": 1,
...@@ -780,12 +801,13 @@ export default function geolocationTest_geo5() { ...@@ -780,12 +801,13 @@ export default function geolocationTest_geo5() {
}).catch((error) => { }).catch((error) => {
console.info("[lbs_js] getAddressesFromLocationName33 promise6 then error." + JSON.stringify(error)); console.info("[lbs_js] getAddressesFromLocationName33 promise6 then error." + JSON.stringify(error));
console.info('[lbs_js] not support now'); console.info('[lbs_js] not support now');
expect(true).assertEqual(JSON.stringify(error) != null); expect(error.code).assertEqual(801);
}); });
}catch(error){ }catch(error){
console.info("[lbs_js] getAddressesFromLocationName33 message6." + JSON.stringify(error.message)); console.info("[lbs_js] getAddressesFromLocationName33 message6." + JSON.stringify(error.message));
expect(true).assertEqual((JSON.stringify(error.message)) != null); expect(true).assertFalse();
} }
await sleep(1000);
let geocodeRequest7 = { let geocodeRequest7 = {
"description": "上海金穗路1800号", "description": "上海金穗路1800号",
"maxItems": 1, "maxItems": 1,
...@@ -800,12 +822,13 @@ export default function geolocationTest_geo5() { ...@@ -800,12 +822,13 @@ export default function geolocationTest_geo5() {
expect(true).assertEqual((JSON.stringify(result)) == null); expect(true).assertEqual((JSON.stringify(result)) == null);
}).catch((error) => { }).catch((error) => {
console.info("[lbs_js] getAddressesFromLocationName33 promise7 then error." + JSON.stringify(error)); console.info("[lbs_js] getAddressesFromLocationName33 promise7 then error." + JSON.stringify(error));
expect(true).assertEqual((JSON.stringify(error)) != null); expect(true).assertFalse();
}); });
}catch(error){ }catch(error){
console.info("[lbs_js] getAddressesFromLocationName33 message7." + JSON.stringify(error.message)); console.info("[lbs_js] getAddressesFromLocationName33 message7." + JSON.stringify(error.message));
expect(true).assertEqual((JSON.stringify(error.message)) != null); expect(error.code).assertEqual("401");
} }
await sleep(1000);
let geocodeRequest8 = { let geocodeRequest8 = {
"description": "上海金穗路1800号", "description": "上海金穗路1800号",
"maxItems": 1, "maxItems": 1,
...@@ -820,12 +843,13 @@ export default function geolocationTest_geo5() { ...@@ -820,12 +843,13 @@ export default function geolocationTest_geo5() {
expect(true).assertEqual((JSON.stringify(result)) == null); expect(true).assertEqual((JSON.stringify(result)) == null);
}).catch((error) => { }).catch((error) => {
console.info("[lbs_js] getAddressesFromLocationName33 promise8 then error." + JSON.stringify(error)); console.info("[lbs_js] getAddressesFromLocationName33 promise8 then error." + JSON.stringify(error));
expect(true).assertEqual((JSON.stringify(error)) != null); expect(true).assertFalse();
}); });
}catch(error){ }catch(error){
console.info("[lbs_js] getAddressesFromLocationName33 message8." + JSON.stringify(error.message)); console.info("[lbs_js] getAddressesFromLocationName33 message8." + JSON.stringify(error.message));
expect(true).assertEqual((JSON.stringify(error.message)) != null); expect(error.code).assertEqual("401");
} }
await sleep(1000);
done(); done();
}) })
...@@ -853,12 +877,13 @@ export default function geolocationTest_geo5() { ...@@ -853,12 +877,13 @@ export default function geolocationTest_geo5() {
}).catch((error) => { }).catch((error) => {
console.info("[lbs_js] getAddressesFromLocationName34 promise1 then error." + JSON.stringify(error)); console.info("[lbs_js] getAddressesFromLocationName34 promise1 then error." + JSON.stringify(error));
console.info('[lbs_js] not support now'); console.info('[lbs_js] not support now');
expect(true).assertEqual(JSON.stringify(error) != null); expect(error.code).assertEqual(801);
}); });
}catch(error){ }catch(error){
console.info("[lbs_js] getAddressesFromLocationName34 message1." + JSON.stringify(error.message)); console.info("[lbs_js] getAddressesFromLocationName34 message1." + JSON.stringify(error.message));
expect(true).assertEqual((JSON.stringify(error.message)) != null); expect(true).assertFalse();
} }
await sleep(1000);
let geocodeRequest2 = { let geocodeRequest2 = {
"description": "北京天安门", "description": "北京天安门",
"maxItems": 1, "maxItems": 1,
...@@ -873,12 +898,14 @@ export default function geolocationTest_geo5() { ...@@ -873,12 +898,14 @@ export default function geolocationTest_geo5() {
expect(true).assertEqual((JSON.stringify(result)) != null); expect(true).assertEqual((JSON.stringify(result)) != null);
}).catch((error) => { }).catch((error) => {
console.info("[lbs_js] getAddressesFromLocationName34 promise2 then error." + JSON.stringify(error)); console.info("[lbs_js] getAddressesFromLocationName34 promise2 then error." + JSON.stringify(error));
expect(error.length != 0).assertTrue(); console.info('[lbs_js] not support now');
expect(error.code).assertEqual(801);
}); });
}catch(error){ }catch(error){
console.info("[lbs_js] getAddressesFromLocationName34 message2." + JSON.stringify(error.message)); console.info("[lbs_js] getAddressesFromLocationName34 message2." + JSON.stringify(error.message));
expect(true).assertEqual((JSON.stringify(error.message)) != null); expect(true).assertFalse();
} }
await sleep(1000);
let geocodeRequest3 = { let geocodeRequest3 = {
"description": "北京天安门", "description": "北京天安门",
"maxItems": 1, "maxItems": 1,
...@@ -893,12 +920,13 @@ export default function geolocationTest_geo5() { ...@@ -893,12 +920,13 @@ export default function geolocationTest_geo5() {
expect(true).assertEqual((JSON.stringify(result)) != null); expect(true).assertEqual((JSON.stringify(result)) != null);
}).catch((error) => { }).catch((error) => {
console.info("[lbs_js] getAddressesFromLocationName34 promise3 then error." + JSON.stringify(error)); console.info("[lbs_js] getAddressesFromLocationName34 promise3 then error." + JSON.stringify(error));
expect(error.length != 0).assertTrue(); expect(true).assertFalse();
}); });
}catch(error){ }catch(error){
console.info("[lbs_js] getAddressesFromLocationName34 message3." + JSON.stringify(error.message)); console.info("[lbs_js] getAddressesFromLocationName34 message3." + JSON.stringify(error.message));
expect(true).assertEqual((JSON.stringify(error.message)) != null); expect(error.code).assertEqual("401");
} }
await sleep(1000);
let geocodeRequest4 = { let geocodeRequest4 = {
"description": "北京天安门", "description": "北京天安门",
"maxItems": 1, "maxItems": 1,
...@@ -913,12 +941,13 @@ export default function geolocationTest_geo5() { ...@@ -913,12 +941,13 @@ export default function geolocationTest_geo5() {
expect(true).assertEqual((JSON.stringify(result)) != null); expect(true).assertEqual((JSON.stringify(result)) != null);
}).catch((error) => { }).catch((error) => {
console.info("[lbs_js] getAddressesFromLocationName34 promise4 then error." + JSON.stringify(error)); console.info("[lbs_js] getAddressesFromLocationName34 promise4 then error." + JSON.stringify(error));
expect(error.length != 0).assertTrue(); expect(true).assertFalse();
}); });
}catch(error){ }catch(error){
console.info("[lbs_js] getAddressesFromLocationName34 message4." + JSON.stringify(error.message)); console.info("[lbs_js] getAddressesFromLocationName34 message4." + JSON.stringify(error.message));
expect(true).assertEqual((JSON.stringify(error.message)) != null); expect(error.code).assertEqual("401");
} }
await sleep(1000);
let geocodeRequest5 = { let geocodeRequest5 = {
"description": "北京天安门", "description": "北京天安门",
"maxItems": 1, "maxItems": 1,
...@@ -933,11 +962,12 @@ export default function geolocationTest_geo5() { ...@@ -933,11 +962,12 @@ export default function geolocationTest_geo5() {
expect(true).assertEqual((JSON.stringify(result)) != null); expect(true).assertEqual((JSON.stringify(result)) != null);
}).catch((error) => { }).catch((error) => {
console.info("[lbs_js] getAddressesFromLocationName34 promise5 then error." + JSON.stringify(error)); console.info("[lbs_js] getAddressesFromLocationName34 promise5 then error." + JSON.stringify(error));
expect(error.length != 0).assertTrue(); console.info('[lbs_js] not support now');
expect(error.code).assertEqual(801);
}); });
}catch(error){ }catch(error){
console.info("[lbs_js] getAddressesFromLocationName34 message5." + JSON.stringify(error.message)); console.info("[lbs_js] getAddressesFromLocationName34 message5." + JSON.stringify(error.message));
expect(true).assertEqual((JSON.stringify(error.message)) != null); expect(true).assertFalse();
} }
let geocodeRequest6 = { let geocodeRequest6 = {
"description": "北京天安门", "description": "北京天安门",
...@@ -953,12 +983,14 @@ export default function geolocationTest_geo5() { ...@@ -953,12 +983,14 @@ export default function geolocationTest_geo5() {
expect(true).assertEqual((JSON.stringify(result)) != null); expect(true).assertEqual((JSON.stringify(result)) != null);
}).catch((error) => { }).catch((error) => {
console.info("[lbs_js] getAddressesFromLocationName34 promise6 then error." + JSON.stringify(error)); console.info("[lbs_js] getAddressesFromLocationName34 promise6 then error." + JSON.stringify(error));
expect(error.length != 0).assertTrue(); console.info('[lbs_js] not support now');
expect(error.code).assertEqual(801);
}); });
}catch(error){ }catch(error){
console.info("[lbs_js] getAddressesFromLocationName34 message6." + JSON.stringify(error.message)); console.info("[lbs_js] getAddressesFromLocationName34 message6." + JSON.stringify(error.message));
expect(true).assertEqual((JSON.stringify(error.message)) != null); expect(true).assertFalse();
} }
await sleep(1000);
let geocodeRequest7 = { let geocodeRequest7 = {
"description": "北京天安门", "description": "北京天安门",
"maxItems": 1, "maxItems": 1,
...@@ -973,11 +1005,11 @@ export default function geolocationTest_geo5() { ...@@ -973,11 +1005,11 @@ export default function geolocationTest_geo5() {
expect(true).assertEqual((JSON.stringify(result)) != null); expect(true).assertEqual((JSON.stringify(result)) != null);
}).catch((error) => { }).catch((error) => {
console.info("[lbs_js] getAddressesFromLocationName34 promise7 then error." + JSON.stringify(error)); console.info("[lbs_js] getAddressesFromLocationName34 promise7 then error." + JSON.stringify(error));
expect(error.length != 0).assertTrue(); expect(true).assertFalse();
}); });
}catch(error){ }catch(error){
console.info("[lbs_js] getAddressesFromLocationName34 message7." + JSON.stringify(error.message)); console.info("[lbs_js] getAddressesFromLocationName34 message7." + JSON.stringify(error.message));
expect(true).assertEqual((JSON.stringify(error.message)) != null); expect(error.code).assertEqual("401");
} }
let geocodeRequest8 = { let geocodeRequest8 = {
"description": "北京天安门", "description": "北京天安门",
...@@ -993,15 +1025,18 @@ export default function geolocationTest_geo5() { ...@@ -993,15 +1025,18 @@ export default function geolocationTest_geo5() {
expect(true).assertEqual((JSON.stringify(result)) != null); expect(true).assertEqual((JSON.stringify(result)) != null);
}).catch((error) => { }).catch((error) => {
console.info("[lbs_js] getAddressesFromLocationName34 promise8 then error." + JSON.stringify(error)); console.info("[lbs_js] getAddressesFromLocationName34 promise8 then error." + JSON.stringify(error));
expect(error.length != 0).assertTrue(); expect(true).assertFalse();
}); });
}catch(error){ }catch(error){
console.info("[lbs_js] getAddressesFromLocationName34 message8." + JSON.stringify(error.message)); console.info("[lbs_js] getAddressesFromLocationName34 message8." + JSON.stringify(error.message));
expect(true).assertEqual((JSON.stringify(error.message)) != null); expect(error.code).assertEqual("401");
} }
await sleep(1000);
done(); done();
}) })
}) })
} }
......
...@@ -30,7 +30,7 @@ async function changedLocationMode(){ ...@@ -30,7 +30,7 @@ async function changedLocationMode(){
console.info('[lbs_js] getLocationSwitchState result: ' + JSON.stringify(result1)); console.info('[lbs_js] getLocationSwitchState result: ' + JSON.stringify(result1));
if(!result1){ if(!result1){
await geolocation.requestEnableLocation().then(async(result) => { await geolocation.requestEnableLocation().then(async(result) => {
await sleep(3000); await sleep(1000);
console.info('[lbs_js] test requestEnableLocation promise result: ' + JSON.stringify(result)); console.info('[lbs_js] test requestEnableLocation promise result: ' + JSON.stringify(result));
}).catch((error) => { }).catch((error) => {
console.info("[lbs_js] promise then error." + JSON.stringify(error)); console.info("[lbs_js] promise then error." + JSON.stringify(error));
...@@ -130,6 +130,7 @@ export default function geolocationTest_6() { ...@@ -130,6 +130,7 @@ export default function geolocationTest_6() {
geolocationm.getCountryCode((err,data) => { geolocationm.getCountryCode((err,data) => {
if (err) { if (err) {
return console.info("[lbs_js] getCountryCode callback err: " + JSON.stringify(err)); return console.info("[lbs_js] getCountryCode callback err: " + JSON.stringify(err));
expect().assertFail();
} else { } else {
console.info("[lbs_js] getCountryCode callback success"+ JSON.stringify(data)); console.info("[lbs_js] getCountryCode callback success"+ JSON.stringify(data));
expect(true).assertEqual(data != null); expect(true).assertEqual(data != null);
...@@ -158,7 +159,7 @@ export default function geolocationTest_6() { ...@@ -158,7 +159,7 @@ export default function geolocationTest_6() {
}); });
} catch (error) { } catch (error) {
console.info("[lbs_js] countryCodeChangeOn try err." + JSON.stringify(error)); console.info("[lbs_js] countryCodeChangeOn try err." + JSON.stringify(error));
expect(true).assertEqual(error != null); expect().assertFail();
} }
try { try {
await geolocationm.getCountryCode().then((result) => { await geolocationm.getCountryCode().then((result) => {
...@@ -178,7 +179,7 @@ export default function geolocationTest_6() { ...@@ -178,7 +179,7 @@ export default function geolocationTest_6() {
}) })
} catch (error) { } catch (error) {
console.info("[lbs_js] countryCodeChangeOn try err." + JSON.stringify(error)); console.info("[lbs_js] countryCodeChangeOn try err." + JSON.stringify(error));
expect(true).assertEqual(error != null); expect().assertFail();
} }
done(); done();
}) })
......
...@@ -39,7 +39,7 @@ async function changedLocationMode(){ ...@@ -39,7 +39,7 @@ async function changedLocationMode(){
console.info('[lbs_js] getLocationSwitchState result: ' + JSON.stringify(result1)); console.info('[lbs_js] getLocationSwitchState result: ' + JSON.stringify(result1));
if(!result1){ if(!result1){
await geolocation.requestEnableLocation().then(async(result) => { await geolocation.requestEnableLocation().then(async(result) => {
await sleep(3000); ;
console.info('[lbs_js] test requestEnableLocation promise result: ' + JSON.stringify(result)); console.info('[lbs_js] test requestEnableLocation promise result: ' + JSON.stringify(result));
}).catch((error) => { }).catch((error) => {
console.info("[lbs_js] promise then error." + JSON.stringify(error)); console.info("[lbs_js] promise then error." + JSON.stringify(error));
...@@ -80,6 +80,7 @@ async function applyPermission() { ...@@ -80,6 +80,7 @@ async function applyPermission() {
console.info('[permission] case accessTokenID is ' + tokenID); console.info('[permission] case accessTokenID is ' + tokenID);
let permissionName1 = 'ohos.permission.LOCATION'; let permissionName1 = 'ohos.permission.LOCATION';
let permissionName2 = 'ohos.permission.LOCATION_IN_BACKGROUND'; let permissionName2 = 'ohos.permission.LOCATION_IN_BACKGROUND';
let permissionName3 = 'ohos.permission.APPROXIMATELY_LOCATION';
await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + JSON.stringify(result)); console.info('[permission] case grantUserGrantedPermission success :' + JSON.stringify(result));
}).catch((err) => { }).catch((err) => {
...@@ -90,6 +91,11 @@ async function applyPermission() { ...@@ -90,6 +91,11 @@ async function applyPermission() {
}).catch((err) => { }).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + JSON.stringify(err)); console.info('[permission] case grantUserGrantedPermission failed :' + JSON.stringify(err));
}); });
await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + JSON.stringify(result));
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + JSON.stringify(err));
});
} else { } else {
console.info('[permission] case apply permission failed, createAtManager failed'); console.info('[permission] case apply permission failed, createAtManager failed');
} }
...@@ -113,6 +119,7 @@ export default function geolocationTest_geo7() { ...@@ -113,6 +119,7 @@ export default function geolocationTest_geo7() {
}) })
/** /**
* @tc.number SUB_HSS_LocationSystem_LocSwitch_0600 * @tc.number SUB_HSS_LocationSystem_LocSwitch_0600
* @tc.name Test requestrequestEnableLocation api * @tc.name Test requestrequestEnableLocation api
...@@ -124,8 +131,8 @@ export default function geolocationTest_geo7() { ...@@ -124,8 +131,8 @@ export default function geolocationTest_geo7() {
it('SUB_HSS_LocationSystem_LocSwitch_0600', 0, function () { it('SUB_HSS_LocationSystem_LocSwitch_0600', 0, function () {
try { try {
let state = geolocationm.isLocationEnabled(); let state = geolocationm.isLocationEnabled();
console.info('[lbs_js] getLocationSwitchState06 result: ' + JSON.stringify(state)); console.info('[lbs_js] getLocationSwitchState06 result: ' + JSON.stringify(state));
expect(true).assertEqual(JSON.stringify(state) != null); expect(true).assertEqual(state);
} catch (error) { } catch (error) {
console.info("[lbs_js] getLocationSwitchState06 try err." + JSON.stringify(error)); console.info("[lbs_js] getLocationSwitchState06 try err." + JSON.stringify(error));
expect().assertFail(); expect().assertFail();
...@@ -147,15 +154,16 @@ export default function geolocationTest_geo7() { ...@@ -147,15 +154,16 @@ export default function geolocationTest_geo7() {
} }
try { try {
geolocationm.on('locationEnabledChange', locationServiceState); geolocationm.on('locationEnabledChange', locationServiceState);
} catch (error) { } catch (error) {
console.info("[lbs_js] locationServiceStateOn07 try err." + JSON.stringify(error)); console.info("[lbs_js] locationServiceStateOn07 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect().assertFail();
} }
try { try {
geolocationm.off('locationEnabledChange', locationServiceState); geolocationm.off('locationEnabledChange', locationServiceState);
} catch (error) { } catch (error) {
console.info("[lbs_js] locationServiceStateOff07 try err." + JSON.stringify(error)); console.info("[lbs_js] locationServiceStateOff07 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect().assertFail();
} }
done(); done();
}) })
...@@ -174,7 +182,7 @@ export default function geolocationTest_geo7() { ...@@ -174,7 +182,7 @@ export default function geolocationTest_geo7() {
geolocationm.getCurrentLocation(currentLocationRequest, (err, result) => { geolocationm.getCurrentLocation(currentLocationRequest, (err, result) => {
if (err) { if (err) {
console.info("[lbs_js] getCurrentLocation15 callback err: " + JSON.stringify(err)); console.info("[lbs_js] getCurrentLocation15 callback err: " + JSON.stringify(err));
expect(true).assertEqual(err != null); expect(err.code).assertEqual(3301200);
console.info('[lbs_js] getCurrentLocationCallback reject after'); console.info('[lbs_js] getCurrentLocationCallback reject after');
done(); done();
} else { } else {
...@@ -184,9 +192,9 @@ export default function geolocationTest_geo7() { ...@@ -184,9 +192,9 @@ export default function geolocationTest_geo7() {
}); });
} catch (error) { } catch (error) {
console.info("[lbs_js] getCurrentLocation15 callback try err." + JSON.stringify(error)); console.info("[lbs_js] getCurrentLocation15 callback try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1500); await sleep(1000);
done(); done();
}) })
...@@ -205,12 +213,13 @@ export default function geolocationTest_geo7() { ...@@ -205,12 +213,13 @@ export default function geolocationTest_geo7() {
console.info('[lbs_js] getCurrentLocation16 promise result ' + JSON.stringify(result)); console.info('[lbs_js] getCurrentLocation16 promise result ' + JSON.stringify(result));
}).catch(error => { }).catch(error => {
console.info('[lbs_js] getCurrentLocation16 promise err:' + JSON.stringify(error)); console.info('[lbs_js] getCurrentLocation16 promise err:' + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(error.code).assertEqual(3301200);
}) })
} catch (error) { } catch (error) {
console.info("[lbs_js] getCurrentLocation16 promise try err." + JSON.stringify(error)); console.info("[lbs_js] getCurrentLocation16 promise try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1000);
done(); done();
}) })
...@@ -230,12 +239,13 @@ export default function geolocationTest_geo7() { ...@@ -230,12 +239,13 @@ export default function geolocationTest_geo7() {
expect(true).assertEqual(result != null); expect(true).assertEqual(result != null);
}).catch(error => { }).catch(error => {
console.info('[lbs_js] getCurrentLocation callback17:' + JSON.stringify(error)); console.info('[lbs_js] getCurrentLocation callback17:' + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(error.code).assertEqual(3301200);
}) })
} catch (error) { } catch (error) {
console.info("[lbs_js] getCurrentLocation callback17 try err." + JSON.stringify(error)); console.info("[lbs_js] getCurrentLocation callback17 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1000);
done(); done();
}) })
...@@ -254,12 +264,13 @@ export default function geolocationTest_geo7() { ...@@ -254,12 +264,13 @@ export default function geolocationTest_geo7() {
console.info('[lbs_js] getCurrentLocation18 promise result ' + JSON.stringify(result)); console.info('[lbs_js] getCurrentLocation18 promise result ' + JSON.stringify(result));
}).catch(error => { }).catch(error => {
console.info('[lbs_js] getCurrentLocation18 promise err:' + JSON.stringify(error)); console.info('[lbs_js] getCurrentLocation18 promise err:' + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(error.code).assertEqual(3301200);
}) })
} catch (error) { } catch (error) {
console.info("[lbs_js] getCurrentLocation18 promise try err." + JSON.stringify(error)); console.info("[lbs_js] getCurrentLocation18 promise try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1000);
done(); done();
}) })
...@@ -278,12 +289,13 @@ export default function geolocationTest_geo7() { ...@@ -278,12 +289,13 @@ export default function geolocationTest_geo7() {
console.info('[lbs_js] getCurrentLocation19 promise result:' + JSON.stringify(result)); console.info('[lbs_js] getCurrentLocation19 promise result:' + JSON.stringify(result));
}).catch(error => { }).catch(error => {
console.info('[lbs_js] getCurrentLocation19 promise err:' + JSON.stringify(error)); console.info('[lbs_js] getCurrentLocation19 promise err:' + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(error.code).assertEqual(3301200);
}) })
} catch (error) { } catch (error) {
console.info("[lbs_js] getCurrentLocation18 promise try err." + JSON.stringify(error)); console.info("[lbs_js] getCurrentLocation18 promise try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1000);
done(); done();
}) })
...@@ -300,27 +312,29 @@ export default function geolocationTest_geo7() { ...@@ -300,27 +312,29 @@ export default function geolocationTest_geo7() {
let currentLocationRequest1 = { "priority": 0x200, "scenario": 0x305, "timeoutMs": 1000, "maxAccuracy": 10 }; let currentLocationRequest1 = { "priority": 0x200, "scenario": 0x305, "timeoutMs": 1000, "maxAccuracy": 10 };
let currentLocationRequest2 = { "priority": 0x200, "scenario": 0x301, "timeoutMs": 1000, "maxAccuracy": 10 }; let currentLocationRequest2 = { "priority": 0x200, "scenario": 0x301, "timeoutMs": 1000, "maxAccuracy": 10 };
try { try {
await geolocationm.getCurrentLocation(currentLocationRequest).then((result) => { await geolocationm.getCurrentLocation(currentLocationRequest1).then((result) => {
console.info('[lbs_js] getCurrentLocation1901 promise result:' + JSON.stringify(result)); console.info('[lbs_js] getCurrentLocation1901 promise result:' + JSON.stringify(result));
}).catch(error => { }).catch(error => {
console.info('[lbs_js] getCurrentLocation1901 promise err:' + JSON.stringify(error)); console.info('[lbs_js] getCurrentLocation1901 promise err:' + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(error.code).assertEqual(3301200);
}) })
} catch (error) { } catch (error) {
console.info("[lbs_js] getCurrentLocation1901 promise try err." + JSON.stringify(error)); console.info("[lbs_js] getCurrentLocation1901 promise try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1000);
try { try {
await geolocationm.getCurrentLocation(currentLocationRequest2).then((result) => { await geolocationm.getCurrentLocation(currentLocationRequest2).then((result) => {
console.info('[lbs_js] getCurrentLocation1902 promise result:' + JSON.stringify(result)); console.info('[lbs_js] getCurrentLocation1902 promise result:' + JSON.stringify(result));
}).catch(error => { }).catch(error => {
console.info('[lbs_js] getCurrentLocation1902 promise err:' + JSON.stringify(error)); console.info('[lbs_js] getCurrentLocation1902 promise err:' + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(error.code).assertEqual(3301200);
}) })
} catch (error) { } catch (error) {
console.info("[lbs_js] getCurrentLocation1902 promise try err." + JSON.stringify(error)); console.info("[lbs_js] getCurrentLocation1902 promise try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1000);
done(); done();
}) })
...@@ -339,12 +353,13 @@ export default function geolocationTest_geo7() { ...@@ -339,12 +353,13 @@ export default function geolocationTest_geo7() {
console.info('[lbs_js] getCurrentLocation21 promise result ' + JSON.stringify(result)); console.info('[lbs_js] getCurrentLocation21 promise result ' + JSON.stringify(result));
}).catch(error => { }).catch(error => {
console.info('[lbs_js] getCurrentLocation21 promise err:' + JSON.stringify(error)); console.info('[lbs_js] getCurrentLocation21 promise err:' + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(error.code).assertEqual(3301200);
}) })
} catch (error) { } catch (error) {
console.info("[lbs_js] getCurrentLocation21 promise try err." + JSON.stringify(error)); console.info("[lbs_js] getCurrentLocation21 promise try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1000);
done(); done();
}) })
...@@ -363,12 +378,13 @@ export default function geolocationTest_geo7() { ...@@ -363,12 +378,13 @@ export default function geolocationTest_geo7() {
console.info('[lbs_js] getCurrentLocation22 promise result:' + JSON.stringify(result)); console.info('[lbs_js] getCurrentLocation22 promise result:' + JSON.stringify(result));
}).catch(error => { }).catch(error => {
console.info('[lbs_js] getCurrentLocation22 promise err:' + JSON.stringify(error)); console.info('[lbs_js] getCurrentLocation22 promise err:' + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(error.code).assertEqual(3301200);
}) })
} catch (error) { } catch (error) {
console.info("[lbs_js] getCurrentLocation22 promise try err." + JSON.stringify(error)); console.info("[lbs_js] getCurrentLocation22 promise try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1000);
done(); done();
}) })
...@@ -387,12 +403,13 @@ export default function geolocationTest_geo7() { ...@@ -387,12 +403,13 @@ export default function geolocationTest_geo7() {
console.info('[lbs_js] getCurrentLocation promise result23:' + JSON.stringify(result)); console.info('[lbs_js] getCurrentLocation promise result23:' + JSON.stringify(result));
}).catch(error => { }).catch(error => {
console.info('[lbs_js] getCurrentLocation promise err23:' + JSON.stringify(error)); console.info('[lbs_js] getCurrentLocation promise err23:' + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(error.code).assertEqual(3301200);
}) })
} catch (error) { } catch (error) {
console.info("[lbs_js] getCurrentLocation23 promise try err." + JSON.stringify(error)); console.info("[lbs_js] getCurrentLocation23 promise try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1000);
done(); done();
}) })
...@@ -412,23 +429,25 @@ export default function geolocationTest_geo7() { ...@@ -412,23 +429,25 @@ export default function geolocationTest_geo7() {
console.info('[lbs_js] getCurrentLocation promise result241 ' + JSON.stringify(result)); console.info('[lbs_js] getCurrentLocation promise result241 ' + JSON.stringify(result));
}).catch(error => { }).catch(error => {
console.info('[lbs_js] getCurrentLocation promise err241:' + JSON.stringify(error)); console.info('[lbs_js] getCurrentLocation promise err241:' + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(error.code).assertEqual(3301200);
}) })
} catch (error) { } catch (error) {
console.info("[lbs_js] getCurrentLocation241 promise try err." + JSON.stringify(error)); console.info("[lbs_js] getCurrentLocation241 promise try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1000);
try { try {
await geolocationm.getCurrentLocation(currentLocationRequest1).then((result) => { await geolocationm.getCurrentLocation(currentLocationRequest1).then((result) => {
console.info('[lbs_js] getCurrentLocation promise result242 ' + JSON.stringify(result)); console.info('[lbs_js] getCurrentLocation promise result242 ' + JSON.stringify(result));
}).catch(error => { }).catch(error => {
console.info('[lbs_js] getCurrentLocation promise err242:' + JSON.stringify(error)); console.info('[lbs_js] getCurrentLocation promise err242:' + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(error.code).assertEqual(3301200);
}) })
} catch (error) { } catch (error) {
console.info("[lbs_js] getCurrentLocation242 promise try err." + JSON.stringify(error)); console.info("[lbs_js] getCurrentLocation242 promise try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1000);
done(); done();
}) })
...@@ -449,23 +468,25 @@ export default function geolocationTest_geo7() { ...@@ -449,23 +468,25 @@ export default function geolocationTest_geo7() {
console.info('[lbs_js] getCurrentLocation promise result251 ' + JSON.stringify(result)); console.info('[lbs_js] getCurrentLocation promise result251 ' + JSON.stringify(result));
}).catch(error => { }).catch(error => {
console.info('[lbs_js] getCurrentLocation promise err251:' + JSON.stringify(error)); console.info('[lbs_js] getCurrentLocation promise err251:' + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(error.code).assertEqual(3301200);
}) })
} catch (error) { } catch (error) {
console.info("[lbs_js] getCurrentLocation251 promise try err." + JSON.stringify(error)); console.info("[lbs_js] getCurrentLocation251 promise try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1000);
try { try {
await geolocationm.getCurrentLocation(currentLocationRequest1).then((result) => { await geolocationm.getCurrentLocation(currentLocationRequest1).then((result) => {
console.info('[lbs_js] getCurrentLocation promise result252 ' + JSON.stringify(result)); console.info('[lbs_js] getCurrentLocation promise result252 ' + JSON.stringify(result));
}).catch(error => { }).catch(error => {
console.info('[lbs_js] getCurrentLocation promise err252:' + JSON.stringify(error)); console.info('[lbs_js] getCurrentLocation promise err252:' + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(error.code).assertEqual(3301200);
}) })
} catch (error) { } catch (error) {
console.info("[lbs_js] getCurrentLocation252 promise try err." + JSON.stringify(error)); console.info("[lbs_js] getCurrentLocation252 promise try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1000);
done(); done();
}) })
...@@ -485,23 +506,25 @@ export default function geolocationTest_geo7() { ...@@ -485,23 +506,25 @@ export default function geolocationTest_geo7() {
console.info('[lbs_js] getCurrentLocation promise result261 ' + JSON.stringify(result)); console.info('[lbs_js] getCurrentLocation promise result261 ' + JSON.stringify(result));
}).catch(error => { }).catch(error => {
console.info('[lbs_js] getCurrentLocation promise err261:' + JSON.stringify(error)); console.info('[lbs_js] getCurrentLocation promise err261:' + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(error.code).assertEqual(3301200);
}) })
} catch (error) { } catch (error) {
console.info("[lbs_js] getCurrentLocation261 promise try err." + JSON.stringify(error)); console.info("[lbs_js] getCurrentLocation261 promise try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1000);
try { try {
await geolocationm.getCurrentLocation(currentLocationRequest1).then((result) => { await geolocationm.getCurrentLocation(currentLocationRequest1).then((result) => {
console.info('[lbs_js] getCurrentLocation promise result262 ' + JSON.stringify(result)); console.info('[lbs_js] getCurrentLocation promise result262 ' + JSON.stringify(result));
}).catch(error => { }).catch(error => {
console.info('[lbs_js] getCurrentLocation promise err262:' + JSON.stringify(error)); console.info('[lbs_js] getCurrentLocation promise err262:' + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(error.code).assertEqual(3301200);
}) })
} catch (error) { } catch (error) {
console.info("[lbs_js] getCurrentLocation262 promise try err." + JSON.stringify(error)); console.info("[lbs_js] getCurrentLocation262 promise try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1000);
done(); done();
}) })
...@@ -521,23 +544,25 @@ export default function geolocationTest_geo7() { ...@@ -521,23 +544,25 @@ export default function geolocationTest_geo7() {
console.info('[lbs_js] getCurrentLocation promise result271 ' + JSON.stringify(result)); console.info('[lbs_js] getCurrentLocation promise result271 ' + JSON.stringify(result));
}).catch(error => { }).catch(error => {
console.info('[lbs_js] getCurrentLocation promise err271:' + JSON.stringify(error)); console.info('[lbs_js] getCurrentLocation promise err271:' + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(error.code).assertEqual(3301200);
}); });
} catch (error) { } catch (error) {
console.info("[lbs_js] getCurrentLocation271 promise try err." + JSON.stringify(error)); console.info("[lbs_js] getCurrentLocation271 promise try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1000);
try { try {
await geolocationm.getCurrentLocation(currentLocationRequest1).then((result) => { await geolocationm.getCurrentLocation(currentLocationRequest1).then((result) => {
console.info('[lbs_js] getCurrentLocation promise result272 ' + JSON.stringify(result)); console.info('[lbs_js] getCurrentLocation promise result272 ' + JSON.stringify(result));
}).catch(error => { }).catch(error => {
console.info('[lbs_js] getCurrentLocation promise err272:' + JSON.stringify(error)); console.info('[lbs_js] getCurrentLocation promise err272:' + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(error.code).assertEqual(3301200);
}) })
} catch (error) { } catch (error) {
console.info("[lbs_js] getCurrentLocation272 promise try err." + JSON.stringify(error)); console.info("[lbs_js] getCurrentLocation272 promise try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1000);
done(); done();
}) })
...@@ -550,20 +575,22 @@ export default function geolocationTest_geo7() { ...@@ -550,20 +575,22 @@ export default function geolocationTest_geo7() {
* @tc.level Level 2 * @tc.level Level 2
*/ */
it('SUB_HSS_SendCommand_0300', 0, async function (done) { it('SUB_HSS_SendCommand_0300', 0, async function (done) {
let requestInfo = { 'scenairo': 0x301, 'command': "command_1" }; let requestInfo = { 'scenario': 0x301, 'command': "command_1" };
try { try {
await geolocationm.sendCommand(requestInfo, (err, result) => { await geolocationm.sendCommand(requestInfo, (err, result) => {
if (err) { if (err) {
console.info('sendcommand callback err:' + JSON.stringify(err)); console.info('sendcommand callback err:' + JSON.stringify(err));
expect(true).assertEqual(JSON.stringify(err) != null); console.info('sendcommand not support');
expect(err.code).assertEqual(801);
done(); done();
} }
console.info('sendcommand callback result:' + JSON.stringify(result)); console.info('sendcommand callback result:' + JSON.stringify(result));
}); });
} catch (error) { } catch (error) {
console.info('sendcommand callback err:' + JSON.stringify(error)); console.info('sendcommand callback err:' + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1000);
done(); done();
}) })
...@@ -576,20 +603,23 @@ export default function geolocationTest_geo7() { ...@@ -576,20 +603,23 @@ export default function geolocationTest_geo7() {
* @tc.level Level 2 * @tc.level Level 2
*/ */
it('SUB_HSS_SendCommand_0400', 0, async function (done) { it('SUB_HSS_SendCommand_0400', 0, async function (done) {
let requestInfo = { 'scenairo': 0x301, 'command': "command_1" }; let requestInfo = { 'scenario': 0x301, 'command': "command_1" };
try { try {
geolocationm.sendCommand(requestInfo).then((result) => { geolocationm.sendCommand(requestInfo).then((result) => {
console.info('sendCommand promise result:' + result); console.info('[lbs_js] sendCommand promise result:' + result);
done(); done();
}).catch(error => { }).catch(error => {
console.info('sendcommand promise err:' + JSON.stringify(error)); console.info('[lbs_js] sendcommand promise err:' + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); console.info('[lbs_js] not support now');
expect(error.code).assertEqual(801);
//expect(true).assertEqual(JSON.stringify(error) != null);
done(); done();
}) })
} catch (error) { } catch (error) {
console.info('sendcommand promise err:' + JSON.stringify(error)); console.info('[lbs_js] sendcommand promise err:' + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1000);
done(); done();
}) })
...@@ -613,14 +643,15 @@ export default function geolocationTest_geo7() { ...@@ -613,14 +643,15 @@ export default function geolocationTest_geo7() {
geolocationm.on('locationChange', requestInfo, locationChange); geolocationm.on('locationChange', requestInfo, locationChange);
} catch (error) { } catch (error) {
console.info("[lbs_js] locationChangerOn16 try err." + JSON.stringify(error)); console.info("[lbs_js] locationChangerOn16 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
try { try {
geolocationm.off('locationChange', locationChange); geolocationm.off('locationChange', locationChange);
} catch (error) { } catch (error) {
console.info("[lbs_js] locationChangerOff16 try err." + JSON.stringify(error)); console.info("[lbs_js] locationChangerOff16 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1000);
done(); done();
}) })
...@@ -644,14 +675,15 @@ export default function geolocationTest_geo7() { ...@@ -644,14 +675,15 @@ export default function geolocationTest_geo7() {
geolocationm.on('locationChange', requestInfo, locationChange); geolocationm.on('locationChange', requestInfo, locationChange);
} catch (error) { } catch (error) {
console.info("[lbs_js] locationChangerOn17 try err." + JSON.stringify(error)); console.info("[lbs_js] locationChangerOn17 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
try { try {
geolocationm.off('locationChange', locationChange); geolocationm.off('locationChange', locationChange);
} catch (error) { } catch (error) {
console.info("[lbs_js] locationChangerOff17 try err." + JSON.stringify(error)); console.info("[lbs_js] locationChangerOff17 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1500);
done(); done();
}) })
...@@ -675,14 +707,15 @@ export default function geolocationTest_geo7() { ...@@ -675,14 +707,15 @@ export default function geolocationTest_geo7() {
geolocationm.on('locationChange', requestInfo, locationChange); geolocationm.on('locationChange', requestInfo, locationChange);
} catch (error) { } catch (error) {
console.info("[lbs_js] locationChangerOn18 try err." + JSON.stringify(error)); console.info("[lbs_js] locationChangerOn18 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
try { try {
geolocationm.off('locationChange', locationChange); geolocationm.off('locationChange', locationChange);
} catch (error) { } catch (error) {
console.info("[lbs_js] locationChangerOff18 try err." + JSON.stringify(error)); console.info("[lbs_js] locationChangerOff18 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1500);
done(); done();
}) })
...@@ -706,14 +739,15 @@ export default function geolocationTest_geo7() { ...@@ -706,14 +739,15 @@ export default function geolocationTest_geo7() {
geolocationm.on('locationChange', requestInfo, locationChange); geolocationm.on('locationChange', requestInfo, locationChange);
} catch (error) { } catch (error) {
console.info("[lbs_js] locationChangerOn19 try err." + JSON.stringify(error)); console.info("[lbs_js] locationChangerOn19 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
try { try {
geolocationm.off('locationChange', locationChange); geolocationm.off('locationChange', locationChange);
} catch (error) { } catch (error) {
console.info("[lbs_js] locationChangerOff19 try err." + JSON.stringify(error)); console.info("[lbs_js] locationChangerOff19 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1500);
done(); done();
}) })
...@@ -742,26 +776,27 @@ export default function geolocationTest_geo7() { ...@@ -742,26 +776,27 @@ export default function geolocationTest_geo7() {
geolocationm.on('locationChange', requestInfo, locationChange1); geolocationm.on('locationChange', requestInfo, locationChange1);
} catch (error) { } catch (error) {
console.info("[lbs_js] locationChangerOn201 try err." + JSON.stringify(error)); console.info("[lbs_js] locationChangerOn201 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
try { try {
geolocationm.on('locationChange', requestInfo, locationChange2); geolocationm.on('locationChange', requestInfo, locationChange2);
} catch (error) { } catch (error) {
console.info("[lbs_js] locationChangerOn202 try err." + JSON.stringify(error)); console.info("[lbs_js] locationChangerOn202 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
try { try {
geolocationm.off('locationChange', locationChange1); geolocationm.off('locationChange', locationChange1);
} catch (error) { } catch (error) {
console.info("[lbs_js] locationChangerOff201 try err." + JSON.stringify(error)); console.info("[lbs_js] locationChangerOff201 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
try { try {
geolocationm.off('locationChange', locationChange2); geolocationm.off('locationChange', locationChange2);
} catch (error) { } catch (error) {
console.info("[lbs_js] locationChangerOff202 try err." + JSON.stringify(error)); console.info("[lbs_js] locationChangerOff202 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1500);
done(); done();
}) })
...@@ -786,14 +821,15 @@ export default function geolocationTest_geo7() { ...@@ -786,14 +821,15 @@ export default function geolocationTest_geo7() {
geolocationm.on('locationChange', requestInfo, locationChange); geolocationm.on('locationChange', requestInfo, locationChange);
} catch (error) { } catch (error) {
console.info("[lbs_js] locationChangerOn21 try err." + JSON.stringify(error)); console.info("[lbs_js] locationChangerOn21 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
try { try {
geolocationm.off('locationChange', locationChange); geolocationm.off('locationChange', locationChange);
} catch (error) { } catch (error) {
console.info("[lbs_js] locationChangerOff21 try err." + JSON.stringify(error)); console.info("[lbs_js] locationChangerOff21 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1500);
done(); done();
}) })
...@@ -818,14 +854,15 @@ export default function geolocationTest_geo7() { ...@@ -818,14 +854,15 @@ export default function geolocationTest_geo7() {
geolocationm.on('locationChange', requestInfo, locationChange); geolocationm.on('locationChange', requestInfo, locationChange);
} catch (error) { } catch (error) {
console.info("[lbs_js] locationChangerOn22 try err." + JSON.stringify(error)); console.info("[lbs_js] locationChangerOn22 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
try { try {
geolocationm.off('locationChange', locationChange); geolocationm.off('locationChange', locationChange);
} catch (error) { } catch (error) {
console.info("[lbs_js] locationChangerOff22 try err." + JSON.stringify(error)); console.info("[lbs_js] locationChangerOff22 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1500);
done(); done();
}) })
...@@ -850,14 +887,15 @@ export default function geolocationTest_geo7() { ...@@ -850,14 +887,15 @@ export default function geolocationTest_geo7() {
geolocationm.on('locationChange', requestInfo, locationChange); geolocationm.on('locationChange', requestInfo, locationChange);
} catch (error) { } catch (error) {
console.info("[lbs_js] locationChangerOn23 try err." + JSON.stringify(error)); console.info("[lbs_js] locationChangerOn23 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
try { try {
geolocationm.off('locationChange', locationChange); geolocationm.off('locationChange', locationChange);
} catch (error) { } catch (error) {
console.info("[lbs_js] locationChangerOff23 try err." + JSON.stringify(error)); console.info("[lbs_js] locationChangerOff23 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1500);
done(); done();
}) })
...@@ -881,14 +919,15 @@ export default function geolocationTest_geo7() { ...@@ -881,14 +919,15 @@ export default function geolocationTest_geo7() {
geolocationm.on('locationChange', requestInfo, locationChange); geolocationm.on('locationChange', requestInfo, locationChange);
} catch (error) { } catch (error) {
console.info("[lbs_js] locationChangerOn24 try err." + JSON.stringify(error)); console.info("[lbs_js] locationChangerOn24 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
try { try {
geolocationm.off('locationChange', locationChange); geolocationm.off('locationChange', locationChange);
} catch (error) { } catch (error) {
console.info("[lbs_js] locationChangerOff24 try err." + JSON.stringify(error)); console.info("[lbs_js] locationChangerOff24 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1500);
done(); done();
}) })
...@@ -912,14 +951,15 @@ export default function geolocationTest_geo7() { ...@@ -912,14 +951,15 @@ export default function geolocationTest_geo7() {
geolocationm.on('locationChange', requestInfo, locationChange); geolocationm.on('locationChange', requestInfo, locationChange);
} catch (error) { } catch (error) {
console.info("[lbs_js] locationChangerOn25 try err." + JSON.stringify(error)); console.info("[lbs_js] locationChangerOn25 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
try { try {
geolocationm.off('locationChange', locationChange); geolocationm.off('locationChange', locationChange);
} catch (error) { } catch (error) {
console.info("[lbs_js] locationChangerOff25 try err." + JSON.stringify(error)); console.info("[lbs_js] locationChangerOff25 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1500);
done(); done();
}) })
...@@ -943,14 +983,15 @@ export default function geolocationTest_geo7() { ...@@ -943,14 +983,15 @@ export default function geolocationTest_geo7() {
geolocationm.on('locationChange', requestInfo, locationChange); geolocationm.on('locationChange', requestInfo, locationChange);
} catch (error) { } catch (error) {
console.info("[lbs_js] locationChangerOn26 try err." + JSON.stringify(error)); console.info("[lbs_js] locationChangerOn26 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
try { try {
geolocationm.off('locationChange', locationChange); geolocationm.off('locationChange', locationChange);
} catch (error) { } catch (error) {
console.info("[lbs_js] locationChangerOff26 try err." + JSON.stringify(error)); console.info("[lbs_js] locationChangerOff26 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1500);
done(); done();
}) })
...@@ -980,26 +1021,28 @@ export default function geolocationTest_geo7() { ...@@ -980,26 +1021,28 @@ export default function geolocationTest_geo7() {
geolocationm.on('locationChange', requestInfo1, locationChange1); geolocationm.on('locationChange', requestInfo1, locationChange1);
} catch (error) { } catch (error) {
console.info("[lbs_js] locationChangerOn271 try err." + JSON.stringify(error)); console.info("[lbs_js] locationChangerOn271 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
try { try {
geolocationm.off('locationChange', locationChange1); geolocationm.off('locationChange', locationChange1);
} catch (error) { } catch (error) {
console.info("[lbs_js] locationChangerOff271 try err." + JSON.stringify(error)); console.info("[lbs_js] locationChangerOff271 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1500);
try { try {
geolocationm.on('locationChange', requestInfo2, locationChange2); geolocationm.on('locationChange', requestInfo2, locationChange2);
} catch (error) { } catch (error) {
console.info("[lbs_js] locationChangerOn272 try err." + JSON.stringify(error)); console.info("[lbs_js] locationChangerOn272 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
try { try {
geolocationm.off('locationChange', locationChange2); geolocationm.off('locationChange', locationChange2);
} catch (error) { } catch (error) {
console.info("[lbs_js] locationChangerOff272 try err." + JSON.stringify(error)); console.info("[lbs_js] locationChangerOff272 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1500);
done(); done();
}) })
...@@ -1029,26 +1072,28 @@ export default function geolocationTest_geo7() { ...@@ -1029,26 +1072,28 @@ export default function geolocationTest_geo7() {
geolocationm.on('locationChange', requestInfo1, locationChange1); geolocationm.on('locationChange', requestInfo1, locationChange1);
} catch (error) { } catch (error) {
console.info("[lbs_js] locationChangerOn281 try err." + JSON.stringify(error)); console.info("[lbs_js] locationChangerOn281 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
try { try {
geolocationm.off('locationChange', locationChange1); geolocationm.off('locationChange', locationChange1);
} catch (error) { } catch (error) {
console.info("[lbs_js] locationChangerOff281 try err." + JSON.stringify(error)); console.info("[lbs_js] locationChangerOff281 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1500);
try { try {
geolocationm.on('locationChange', requestInfo2, locationChange2); geolocationm.on('locationChange', requestInfo2, locationChange2);
} catch (error) { } catch (error) {
console.info("[lbs_js] locationChangerOn282 try err." + JSON.stringify(error)); console.info("[lbs_js] locationChangerOn282 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
try { try {
geolocationm.off('locationChange', locationChange2); geolocationm.off('locationChange', locationChange2);
} catch (error) { } catch (error) {
console.info("[lbs_js] locationChangerOff282 try err." + JSON.stringify(error)); console.info("[lbs_js] locationChangerOff282 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1500);
done(); done();
}) })
...@@ -1078,26 +1123,28 @@ export default function geolocationTest_geo7() { ...@@ -1078,26 +1123,28 @@ export default function geolocationTest_geo7() {
geolocationm.on('locationChange', requestInfo1, locationChange1); geolocationm.on('locationChange', requestInfo1, locationChange1);
} catch (error) { } catch (error) {
console.info("[lbs_js] locationChangerOn291 try err." + JSON.stringify(error)); console.info("[lbs_js] locationChangerOn291 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
try { try {
geolocationm.off('locationChange', locationChange1); geolocationm.off('locationChange', locationChange1);
} catch (error) { } catch (error) {
console.info("[lbs_js] locationChangerOff291 try err." + JSON.stringify(error)); console.info("[lbs_js] locationChangerOff291 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1500);
try { try {
geolocationm.on('locationChange', requestInfo2, locationChange2); geolocationm.on('locationChange', requestInfo2, locationChange2);
} catch (error) { } catch (error) {
console.info("[lbs_js] locationChangerOn292 try err." + JSON.stringify(error)); console.info("[lbs_js] locationChangerOn292 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
try { try {
geolocationm.off('locationChange', locationChange2); geolocationm.off('locationChange', locationChange2);
} catch (error) { } catch (error) {
console.info("[lbs_js] locationChangerOff292 try err." + JSON.stringify(error)); console.info("[lbs_js] locationChangerOff292 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1500);
done(); done();
}) })
...@@ -1121,26 +1168,30 @@ export default function geolocationTest_geo7() { ...@@ -1121,26 +1168,30 @@ export default function geolocationTest_geo7() {
geolocationm.on('locationChange', requestInfo, locationChange); geolocationm.on('locationChange', requestInfo, locationChange);
} catch (error) { } catch (error) {
console.info("[lbs_js] locationChangerOn03 try err." + JSON.stringify(error)); console.info("[lbs_js] locationChangerOn03 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
try { try {
geolocationm.off('locationChange', locationChange); geolocationm.off('locationChange', locationChange);
} catch (error) { } catch (error) {
console.info("[lbs_js] locationChangerOff03 try err." + JSON.stringify(error)); console.info("[lbs_js] locationChangerOff03 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1500);
try { try {
let last =geolocationm.getLastLocation(); let last =geolocationm.getLastLocation();
console.info('[lbs_js] getLastLocation latitude: ' + result.latitude + console.info('[lbs_js] getLastLocation latitude: ' + last.latitude +
' longitude: ' + result.longitude +' altitude: ' + result.altitude ' longitude: ' + result.longitude +' altitude: ' + result.altitude
+' accuracy: ' + result.accuracy+' speed: ' + result.speed + +' accuracy: ' + result.accuracy+' speed: ' + result.speed +
'timeStamp: ' + result.timeStamp+'direction:' + result.direction+' timeSinceBoot: ' 'timeStamp: ' + result.timeStamp+'direction:' + result.direction+' timeSinceBoot: '
+ result.timeSinceBoot +'additions: ' + result.additions+' additionSize' + result.additionSize + result.timeSinceBoot +'additions: ' + result.additions+' additionSize' + result.additionSize
+ 'isFromMock' +result.isFromMock); + 'isFromMock' +result.isFromMock);
expect(true).assertEqual(JSON.stringify(last) != null); expect(true).assertEqual(JSON.stringify(last) != null);
} catch (error) { } catch (error) {
console.info("[lbs_js] getLastLocation error:"+ error) console.info("[lbs_js] getLastLocation error:"+ error)
expect(error.code).assertEqual("3301200");
} }
await sleep(1500);
done(); done();
}) })
...@@ -1166,7 +1217,7 @@ export default function geolocationTest_geo7() { ...@@ -1166,7 +1217,7 @@ export default function geolocationTest_geo7() {
geolocationm.on('satelliteStatusChange', gnssStatusCb); geolocationm.on('satelliteStatusChange', gnssStatusCb);
} catch (error) { } catch (error) {
console.info("[lbs_js] satelliteStatusOn03 try err." + JSON.stringify(error)); console.info("[lbs_js] satelliteStatusOn03 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
enableLocationSwitch(); enableLocationSwitch();
let requestInfo = {"priority":0x200, "scenario":0x301, "timeInterval":0, let requestInfo = {"priority":0x200, "scenario":0x301, "timeInterval":0,
...@@ -1179,20 +1230,21 @@ export default function geolocationTest_geo7() { ...@@ -1179,20 +1230,21 @@ export default function geolocationTest_geo7() {
geolocationm.on('locationChange', requestInfo, locationChange); geolocationm.on('locationChange', requestInfo, locationChange);
} catch (error) { } catch (error) {
console.info("[lbs_js] locationChangerOn03 try err." + JSON.stringify(error)); console.info("[lbs_js] locationChangerOn03 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
try { try {
geolocationm.off('satelliteStatusChange', gnssStatusCb); geolocationm.off('satelliteStatusChange', gnssStatusCb);
} catch (error) { } catch (error) {
console.info("[lbs_js] satelliteStatusOff03 try err." + JSON.stringify(error)); console.info("[lbs_js] satelliteStatusOff03 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
try { try {
geolocationm.off('locationChange', locationChange); geolocationm.off('locationChange', locationChange);
} catch (error) { } catch (error) {
console.info("[lbs_js] locationChangerOff03 try err." + JSON.stringify(error)); console.info("[lbs_js] locationChangerOff03 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1000);
done(); done();
}) })
...@@ -1219,8 +1271,7 @@ export default function geolocationTest_geo7() { ...@@ -1219,8 +1271,7 @@ export default function geolocationTest_geo7() {
geolocationm.on('nmeaMessage', nmeaCb); geolocationm.on('nmeaMessage', nmeaCb);
} catch (error) { } catch (error) {
console.info("nmea on err:" + JSON.stringify(error)); console.info("nmea on err:" + JSON.stringify(error));
expect(true).assertEqual(error !=null); expect(true).assertFalse();
done();
} }
try { try {
geolocationm.on('locationChange', requestInfo, locationChange); geolocationm.on('locationChange', requestInfo, locationChange);
...@@ -1232,14 +1283,15 @@ export default function geolocationTest_geo7() { ...@@ -1232,14 +1283,15 @@ export default function geolocationTest_geo7() {
geolocationm.off('nmeaMessage', nmeaCb); geolocationm.off('nmeaMessage', nmeaCb);
} catch (error) { } catch (error) {
console.info("nmea off err:" + JSON.stringify(error)); console.info("nmea off err:" + JSON.stringify(error));
expect(true).assertEqual(error !=null); expect(true).assertFalse();
} }
try { try {
geolocationm.off('locationChange', locationChange); geolocationm.off('locationChange', locationChange);
} catch (error) { } catch (error) {
console.info("[lbs_js] locationChangerOff03 try err." + JSON.stringify(error)); console.info("[lbs_js] locationChangerOff03 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1000);
done(); done();
}) })
...@@ -1261,14 +1313,16 @@ export default function geolocationTest_geo7() { ...@@ -1261,14 +1313,16 @@ export default function geolocationTest_geo7() {
geolocationm.on('cachedGnssLocationsChange', CachedGnssLoactionsRequest1, cachedLocationsCb1); geolocationm.on('cachedGnssLocationsChange', CachedGnssLoactionsRequest1, cachedLocationsCb1);
} catch (error) { } catch (error) {
console.info("[lbs_js] cachedGnssLocOn071 try err." + JSON.stringify(error)); console.info("[lbs_js] cachedGnssLocOn071 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(error.code).assertEqual("801");
} }
try { try {
geolocationm.off('cachedGnssLocationsChange',cachedLocationsCb1); geolocationm.off('cachedGnssLocationsChange',cachedLocationsCb1);
} catch (error) { } catch (error) {
console.info("[lbs_js] cachedGnssLocOff071 try err." + JSON.stringify(error)); console.info("[lbs_js] cachedGnssLocOff071 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); console.info('[lbs_js] not support now');
expect(error.code).assertEqual("801");
} }
await sleep(1500);
var cachedLocationsCb2 = (locations) => { var cachedLocationsCb2 = (locations) => {
console.log('[lbs_js] cachedGnssLocationsReporting7:locations:' + JSON.stringify(locations)); console.log('[lbs_js] cachedGnssLocationsReporting7:locations:' + JSON.stringify(locations));
expect(true).assertEqual(locations !=null); expect(true).assertEqual(locations !=null);
...@@ -1278,14 +1332,17 @@ export default function geolocationTest_geo7() { ...@@ -1278,14 +1332,17 @@ export default function geolocationTest_geo7() {
geolocationm.on('cachedGnssLocationsChange', CachedGnssLoactionsRequest2, cachedLocationsCb2); geolocationm.on('cachedGnssLocationsChange', CachedGnssLoactionsRequest2, cachedLocationsCb2);
} catch (error) { } catch (error) {
console.info("[lbs_js] cachedGnssLocOn072 try err." + JSON.stringify(error)); console.info("[lbs_js] cachedGnssLocOn072 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); console.info('[lbs_js] not support now');
expect(error.code).assertEqual("801");
} }
try { try {
geolocationm.off('cachedGnssLocationsChange',cachedLocationsCb1); geolocationm.off('cachedGnssLocationsChange',cachedLocationsCb1);
} catch (error) { } catch (error) {
console.info("[lbs_js] cachedGnssLocOff072 try err." + JSON.stringify(error)); console.info("[lbs_js] cachedGnssLocOff072 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); console.info('[lbs_js] not support now');
expect(error.code).assertEqual("801");
} }
await sleep(1500);
done(); done();
}) })
...@@ -1307,14 +1364,17 @@ export default function geolocationTest_geo7() { ...@@ -1307,14 +1364,17 @@ export default function geolocationTest_geo7() {
geolocationm.on('cachedGnssLocationsChange', CachedGnssLoactionsRequest, cachedLocationsCb); geolocationm.on('cachedGnssLocationsChange', CachedGnssLoactionsRequest, cachedLocationsCb);
} catch (error) { } catch (error) {
console.info("[lbs_js] cachedGnssLocOn08 try err." + JSON.stringify(error)); console.info("[lbs_js] cachedGnssLocOn08 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); console.info('[lbs_js] not support now');
expect(error.code).assertEqual("801");
} }
try { try {
geolocationm.off('cachedGnssLocationsChange',cachedLocationsCb); geolocationm.off('cachedGnssLocationsChange',cachedLocationsCb);
} catch (error) { } catch (error) {
console.info("[lbs_js] cachedGnssLocOff08 try err." + JSON.stringify(error)); console.info("[lbs_js] cachedGnssLocOff08 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); console.info('[lbs_js] not support now');
expect(error.code).assertEqual("801");
} }
await sleep(1500);
done(); done();
}) })
...@@ -1336,19 +1396,23 @@ export default function geolocationTest_geo7() { ...@@ -1336,19 +1396,23 @@ export default function geolocationTest_geo7() {
geolocationm.on('cachedGnssLocationsChange', CachedGnssLoactionsRequest, cachedLocationsCb); geolocationm.on('cachedGnssLocationsChange', CachedGnssLoactionsRequest, cachedLocationsCb);
} catch (error) { } catch (error) {
console.info("[lbs_js] cachedGnssLocOn09 try err." + JSON.stringify(error)); console.info("[lbs_js] cachedGnssLocOn09 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); console.info('[lbs_js] not support now');
expect(error.code).assertEqual("801");
} }
try { try {
geolocationm.off('cachedGnssLocationsChange',cachedLocationsCb); geolocationm.off('cachedGnssLocationsChange',cachedLocationsCb);
} catch (error) { } catch (error) {
console.info("[lbs_js] cachedGnssLocOff09 try err." + JSON.stringify(error)); console.info("[lbs_js] cachedGnssLocOff09 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); console.info('[lbs_js] not support now');
expect(error.code).assertEqual("801");
} }
await sleep(1500);
try { try {
geolocationm.getCachedGnssLocationsSize((err, data) => { geolocationm.getCachedGnssLocationsSize((err, data) => {
if (err) { if (err) {
console.info('[lbs_js] getCachedGnssLocationsSize09 callback err:' + JSON.stringify(err)); console.info('[lbs_js] getCachedGnssLocationsSize09 callback err:' + JSON.stringify(err));
expect(true).assertEqual(err != null); console.info('[lbs_js] not support now');
expect(err.code).assertEqual(801);
}else { }else {
console.info("[lbs_js] getCachedGnssLocationsSize09 callback data:" + JSON.stringify(data)); console.info("[lbs_js] getCachedGnssLocationsSize09 callback data:" + JSON.stringify(data));
expect(true).assertEqual(data != null); expect(true).assertEqual(data != null);
...@@ -1356,7 +1420,8 @@ export default function geolocationTest_geo7() { ...@@ -1356,7 +1420,8 @@ export default function geolocationTest_geo7() {
}); });
} catch (error) { } catch (error) {
console.info("[lbs_js] getCachedGnssLocationsSize09 callback try err." + JSON.stringify(error)); console.info("[lbs_js] getCachedGnssLocationsSize09 callback try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1000); await sleep(1000);
done(); done();
...@@ -1380,26 +1445,31 @@ export default function geolocationTest_geo7() { ...@@ -1380,26 +1445,31 @@ export default function geolocationTest_geo7() {
geolocationm.on('cachedGnssLocationsChange', CachedGnssLoactionsRequest, cachedLocationsCb); geolocationm.on('cachedGnssLocationsChange', CachedGnssLoactionsRequest, cachedLocationsCb);
} catch (error) { } catch (error) {
console.info("[lbs_js] cachedGnssLocOn10 try err." + JSON.stringify(error)); console.info("[lbs_js] cachedGnssLocOn10 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); console.info('[lbs_js] not support now');
expect(error.code).assertEqual("801");
} }
try { try {
geolocationm.off('cachedGnssLocationsChange',cachedLocationsCb); geolocationm.off('cachedGnssLocationsChange',cachedLocationsCb);
} catch (error) { } catch (error) {
console.info("[lbs_js] cachedGnssLocOff10 try err." + JSON.stringify(error)); console.info("[lbs_js] cachedGnssLocOff10 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); console.info('[lbs_js] not support now');
expect(error.code).assertEqual("801");
} }
await sleep(1000);
try { try {
await geolocationm.getCachedGnssLocationsSize().then( (result) => { await geolocationm.getCachedGnssLocationsSize().then( (result) => {
console.info('[lbs_js] getCachedGnssLocationsSiz promise '+ JSON.stringify(result)); console.info('[lbs_js] getCachedGnssLocationsSiz promise '+ JSON.stringify(result));
expect(true).assertEqual(result != null); expect(true).assertEqual(result != null);
}).catch((error) => { }).catch((error) => {
console.info("[lbs_js] promise then error." + JSON.stringify(error)); console.info("[lbs_js] promise then error." + JSON.stringify(error));
expect(true).assertEqual(error != null); console.info('[lbs_js] not support now');
expect(error.code).assertEqual(801);
}); });
} catch (error) { } catch (error) {
console.info("[lbs_js] getCachedGnssLocationsSize promise try err." + JSON.stringify(error)); console.info("[lbs_js] getCachedGnssLocationsSize promise try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1500);
done(); done();
}) })
...@@ -1421,19 +1491,23 @@ export default function geolocationTest_geo7() { ...@@ -1421,19 +1491,23 @@ export default function geolocationTest_geo7() {
geolocationm.on('cachedGnssLocationsChange', CachedGnssLoactionsRequest, cachedLocationsCb); geolocationm.on('cachedGnssLocationsChange', CachedGnssLoactionsRequest, cachedLocationsCb);
} catch (error) { } catch (error) {
console.info("[lbs_js] cachedGnssLocOn11 try err." + JSON.stringify(error)); console.info("[lbs_js] cachedGnssLocOn11 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); console.info('[lbs_js] not support now');
expect(error.code).assertEqual("801");
} }
try { try {
geolocationm.off('cachedGnssLocationsChange',cachedLocationsCb); geolocationm.off('cachedGnssLocationsChange',cachedLocationsCb);
} catch (error) { } catch (error) {
console.info("[lbs_js] cachedGnssLocOff11 try err." + JSON.stringify(error)); console.info("[lbs_js] cachedGnssLocOff11 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); console.info('[lbs_js] not support now');
expect(error.code).assertEqual("801");
} }
await sleep(1000);
try { try {
geolocationm.flushCachedGnssLocations((err, data) => { geolocationm.flushCachedGnssLocations((err, data) => {
if (err) { if (err) {
console.info('[lbs_js] flushCachedGnssLocations11 callback err is : ' + JSON.stringify(err)); console.info('[lbs_js] flushCachedGnssLocations11 callback err is : ' + JSON.stringify(err));
expect(true).assertEqual(err != null); console.info('[lbs_js] not support now');
expect(err.code).assertEqual(801);
}else { }else {
console.info("[lbs_js] flushCachedGnssLocations11 callback data is: " + JSON.stringify(data)); console.info("[lbs_js] flushCachedGnssLocations11 callback data is: " + JSON.stringify(data));
expect(true).assertEqual(data != null); expect(true).assertEqual(data != null);
...@@ -1441,7 +1515,7 @@ export default function geolocationTest_geo7() { ...@@ -1441,7 +1515,7 @@ export default function geolocationTest_geo7() {
}); });
} catch (error) { } catch (error) {
console.info("[lbs_js] flushCachedGnssLocations11 callback try err." + JSON.stringify(error)); console.info("[lbs_js] flushCachedGnssLocations11 callback try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1000); await sleep(1000);
done(); done();
...@@ -1465,25 +1539,31 @@ export default function geolocationTest_geo7() { ...@@ -1465,25 +1539,31 @@ export default function geolocationTest_geo7() {
geolocationm.on('cachedGnssLocationsChange', CachedGnssLoactionsRequest, cachedLocationsCb); geolocationm.on('cachedGnssLocationsChange', CachedGnssLoactionsRequest, cachedLocationsCb);
} catch (error) { } catch (error) {
console.info("[lbs_js] cachedGnssLocOn11 try err." + JSON.stringify(error)); console.info("[lbs_js] cachedGnssLocOn11 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); console.info('[lbs_js] not support now');
expect(error.code).assertEqual("801");
} }
try { try {
geolocationm.off('cachedGnssLocationsChange',cachedLocationsCb); geolocationm.off('cachedGnssLocationsChange',cachedLocationsCb);
} catch (error) { } catch (error) {
console.info("[lbs_js] cachedGnssLocOff11 try err." + JSON.stringify(error)); console.info("[lbs_js] cachedGnssLocOff11 try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); console.info('[lbs_js] not support now');
expect(error.code).assertEqual("801");
} }
await sleep(1000);
try { try {
await geolocationm.flushCachedGnssLocations().then( (result) => { await geolocationm.flushCachedGnssLocations().then( (result) => {
console.info('[lbs_js] flushCachedGnssLocations promise '+ JSON.stringify(result)); console.info('[lbs_js] flushCachedGnssLocations promise '+ JSON.stringify(result));
expect(true).assertEqual(result != null); expect(true).assertEqual(result != null);
}).catch((error) => { }).catch((error) => {
console.info("[lbs_js] promise then error." + JSON.stringify(error)); console.info("[lbs_js] promise then error." + JSON.stringify(error));
console.info('[lbs_js] not support now');
expect(error.code).assertEqual(801);
}); });
} catch (error) { } catch (error) {
console.info("[lbs_js] flushCachedGnssLocations11 promise try err." + JSON.stringify(error)); console.info("[lbs_js] flushCachedGnssLocations11 promise try err." + JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); expect(true).assertFalse();
} }
await sleep(1000);
done(); done();
}) })
...@@ -1510,7 +1590,8 @@ export default function geolocationTest_geo7() { ...@@ -1510,7 +1590,8 @@ export default function geolocationTest_geo7() {
}); });
} catch (error) { } catch (error) {
console.info("[lbs_js] FenceStatusOn2 try error:"+ JSON.stringify(error)); console.info("[lbs_js] FenceStatusOn2 try error:"+ JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); console.info('[lbs_js] not support now');
expect(error.code).assertEqual("801");
} }
try { try {
geolocationm.off('gnssFenceStatusChange',geofenceRequest, geolocationm.off('gnssFenceStatusChange',geofenceRequest,
...@@ -1523,7 +1604,8 @@ export default function geolocationTest_geo7() { ...@@ -1523,7 +1604,8 @@ export default function geolocationTest_geo7() {
}); });
} catch (error) { } catch (error) {
console.info("[lbs_js] FenceStatusOff2 try error:"+ JSON.stringify(error)); console.info("[lbs_js] FenceStatusOff2 try error:"+ JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); console.info('[lbs_js] not support now');
expect(error.code).assertEqual("801");
} }
await sleep(1000); await sleep(1000);
done(); done();
...@@ -1546,13 +1628,16 @@ export default function geolocationTest_geo7() { ...@@ -1546,13 +1628,16 @@ export default function geolocationTest_geo7() {
(want) => { (want) => {
if(err){ if(err){
return console.info("[lbs_js] fenceStatusChange3 on callback err: " + err); return console.info("[lbs_js] fenceStatusChange3 on callback err: " + err);
console.info("[lbs_js] fenceStatusChange not support ");
expect(err.code).assertEqual(801);
} }
console.info("[lbs_js] fenceStatusChange3 callback result: " + JSON.stringify(want)); console.info("[lbs_js] fenceStatusChange3 callback result: " + JSON.stringify(want));
expect(true).assertEqual(want !=null); expect(true).assertEqual(want !=null);
}); });
} catch (error) { } catch (error) {
console.info("[lbs_js] FenceStatusOn3 try error:"+ JSON.stringify(error)); console.info("[lbs_js] FenceStatusOn3 try error:"+ JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); console.info('[lbs_js] not support now');
expect(error.code).assertEqual("801");
} }
try { try {
geolocationm.off('gnssFenceStatusChange',geofenceRequest, geolocationm.off('gnssFenceStatusChange',geofenceRequest,
...@@ -1565,7 +1650,8 @@ export default function geolocationTest_geo7() { ...@@ -1565,7 +1650,8 @@ export default function geolocationTest_geo7() {
}); });
} catch (error) { } catch (error) {
console.info("[lbs_js] FenceStatusOff3 try error:"+ JSON.stringify(error)); console.info("[lbs_js] FenceStatusOff3 try error:"+ JSON.stringify(error));
expect(true).assertEqual(JSON.stringify(error) != null); console.info('[lbs_js] not support now');
expect(error.code).assertEqual("801");
} }
await sleep(1000); await sleep(1000);
done(); done();
......
...@@ -21,6 +21,8 @@ ohos_js_hap_suite("image_creator_js_hap") { ...@@ -21,6 +21,8 @@ ohos_js_hap_suite("image_creator_js_hap") {
] ]
certificate_profile = "./signature/openharmony_sx.p7b" certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsImageCreatorJsTest" hap_name = "ActsImageCreatorJsTest"
subsystem_name = "multimedia"
part_name = "multimedia_image_framework"
} }
ohos_js_assets("image_creator_js_assets") { ohos_js_assets("image_creator_js_assets") {
source_dir = "./src/main/js/default" source_dir = "./src/main/js/default"
......
...@@ -21,6 +21,8 @@ ohos_js_hap_suite("image_rgba_js_hap") { ...@@ -21,6 +21,8 @@ ohos_js_hap_suite("image_rgba_js_hap") {
] ]
certificate_profile = "./signature/openharmony_sx.p7b" certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsImageRGBAJsTest" hap_name = "ActsImageRGBAJsTest"
subsystem_name = "multimedia"
part_name = "multimedia_image_framework"
} }
ohos_js_assets("image_rgba_js_assets") { ohos_js_assets("image_rgba_js_assets") {
source_dir = "./src/main/js/default" source_dir = "./src/main/js/default"
......
...@@ -16,17 +16,24 @@ ...@@ -16,17 +16,24 @@
import media from '@ohos.multimedia.media' import media from '@ohos.multimedia.media'
import * as mediaTestBase from './MediaTestBase.js'; import * as mediaTestBase from './MediaTestBase.js';
async function idleCallBack(avRecorder) { export function resourceName(){
console.info('case createAVRecorder called'); let timestamp = Date.now();
await media.createAVRecorder((error, recorder) => { let filename = `avRecorder_${timestamp}.m4a`;
return filename;
}
export async function idleCallback(avRecorder, avConfig, done) {
console.info('case idleCallback called');
media.createAVRecorder((error, recorder) => {
if (recorder != null) { if (recorder != null) {
avRecorder = recorder; avRecorder = recorder;
console.info('createAVRecorder success'); console.info('createAVRecorder idleCallback success');
avRecorder.prepare(avConfig)
releaseDone(avRecorder, done)
} else { } else {
console.info(`createAVRecorder fail, error:${error}`); console.info(`createAVRecorder idleCallback fail, error:${error}`);
} }
}); });
return avRecorder;
} }
export async function idle(avRecorder) { export async function idle(avRecorder) {
...@@ -1378,6 +1385,10 @@ export async function avRecorderReliabilitTest03(avConfig, avRecorder, recorderT ...@@ -1378,6 +1385,10 @@ export async function avRecorderReliabilitTest03(avConfig, avRecorder, recorderT
await avRecorder.prepare(avConfig) await avRecorder.prepare(avConfig)
} }
export async function avRecorderReliabilitTest001(avConfig, avRecorder, recorderTime, done) {
idleCallback(avRecorder, avConfig, done)
}
export async function avRecorderReliabilitTest04(avConfig, avRecorder, recorderTime, done) { export async function avRecorderReliabilitTest04(avConfig, avRecorder, recorderTime, done) {
let result = true; let result = true;
avRecorder = await idle(avRecorder); avRecorder = await idle(avRecorder);
...@@ -2260,25 +2271,28 @@ export async function createTimeTestCallback(avConfig, avRecorder, recorderTime, ...@@ -2260,25 +2271,28 @@ export async function createTimeTestCallback(avConfig, avRecorder, recorderTime,
for(var i = 0;i < 10;i++){ for(var i = 0;i < 10;i++){
let start = Date.now(); let start = Date.now();
console.info(`createTimeTestCallback start time is : ${start}`) console.info(`createTimeTestCallback start time is : ${start}`)
avRecorder = await idleCallBack(avRecorder); avRecorder = await idle(avRecorder);
let end = Date.now() let end = Date.now()
let execution = parseInt(end - start) let execution = parseInt(end - start)
console.info("createTimeTestCallback execution time is :" + execution) console.info("createTimeTestCallback execution time is :" + execution)
totalTime = totalTime + execution; totalTime = totalTime + execution;
await avRecorder.release().then(() => { await avRecorder.release().then(() => {
console.info('createTimeTestCallback avPlayer is release') console.info('createTimeTestCallback avPlayer is release')
console.info(`createTimeTestCallback avRecorder.state is : ${avRecorder.state}`)
expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.RELEASED); expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.RELEASED);
if(i == 9){
let avg = totalTime/10;
console.info("createTimeTest avg time is :" + avg)
done();
}
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
} }
let avg = totalTime/10;
console.info("createTimeTest avg time is :" + avg)
done();
} }
export async function prepareTimeCallback(avConfig, avRecorder, recorderTime, done) { export async function prepareTimeCallback(avConfig, avRecorder, recorderTime, done) {
let totalTime = 0; let totalTime = 0;
for(var i = 0;i < 10;i++){ for(var i = 0;i < 10;i++){
avRecorder = await idleCallBack(avRecorder); avRecorder = await idle(avRecorder);
await sleep(20) await sleep(20)
let start = Date.now(); let start = Date.now();
console.info(`prepareTimeWithoutCallback start time is : ${start}`) console.info(`prepareTimeWithoutCallback start time is : ${start}`)
...@@ -2310,7 +2324,7 @@ export async function getInputSurfaceTimeTestCallback(avConfig, avRecorder, reco ...@@ -2310,7 +2324,7 @@ export async function getInputSurfaceTimeTestCallback(avConfig, avRecorder, reco
let totalTime = 0; let totalTime = 0;
let surfaceID = null; let surfaceID = null;
for(var i = 0;i < 10;i++){ for(var i = 0;i < 10;i++){
avRecorder = await idleCallBack(avRecorder); avRecorder = await idle(avRecorder);
await sleep(20) await sleep(20)
let end; let end;
await avRecorder.prepare(avConfig).then(() => { await avRecorder.prepare(avConfig).then(() => {
...@@ -2346,7 +2360,7 @@ export async function getInputSurfaceTimeTestCallback(avConfig, avRecorder, reco ...@@ -2346,7 +2360,7 @@ export async function getInputSurfaceTimeTestCallback(avConfig, avRecorder, reco
export async function startTimeTestCallback(avConfig, avRecorder, recorderTime, done) { export async function startTimeTestCallback(avConfig, avRecorder, recorderTime, done) {
let totalTime = 0; let totalTime = 0;
for(var i = 0;i < 10;i++){ for(var i = 0;i < 10;i++){
avRecorder = await idleCallBack(avRecorder); avRecorder = await idle(avRecorder);
await sleep(20) await sleep(20)
let end; let end;
await avRecorder.prepare(avConfig).then(() => { await avRecorder.prepare(avConfig).then(() => {
...@@ -2380,7 +2394,7 @@ export async function startTimeTestCallback(avConfig, avRecorder, recorderTime, ...@@ -2380,7 +2394,7 @@ export async function startTimeTestCallback(avConfig, avRecorder, recorderTime,
export async function pauseTimeTestCallback(avConfig, avRecorder, recorderTime, done) { export async function pauseTimeTestCallback(avConfig, avRecorder, recorderTime, done) {
let totalTime = 0; let totalTime = 0;
for(var i = 0;i < 10;i++){ for(var i = 0;i < 10;i++){
avRecorder = await idleCallBack(avRecorder); avRecorder = await idle(avRecorder);
await sleep(20) await sleep(20)
await avRecorder.prepare(avConfig).then(() => { await avRecorder.prepare(avConfig).then(() => {
expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.PREPARED); expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.PREPARED);
...@@ -2420,7 +2434,7 @@ export async function pauseTimeTestCallback(avConfig, avRecorder, recorderTime, ...@@ -2420,7 +2434,7 @@ export async function pauseTimeTestCallback(avConfig, avRecorder, recorderTime,
export async function resumeTimeTestCallback(avConfig, avRecorder, recorderTime, done) { export async function resumeTimeTestCallback(avConfig, avRecorder, recorderTime, done) {
let totalTime = 0; let totalTime = 0;
for(var i = 0;i < 10;i++){ for(var i = 0;i < 10;i++){
avRecorder = await idleCallBack(avRecorder); avRecorder = await idle(avRecorder);
await sleep(20) await sleep(20)
await avRecorder.prepare(avConfig).then(() => { await avRecorder.prepare(avConfig).then(() => {
expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.PREPARED); expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.PREPARED);
...@@ -2467,7 +2481,7 @@ export async function resumeTimeTestCallback(avConfig, avRecorder, recorderTime, ...@@ -2467,7 +2481,7 @@ export async function resumeTimeTestCallback(avConfig, avRecorder, recorderTime,
export async function stopTimeTestCallback(avConfig, avRecorder, recorderTime, done) { export async function stopTimeTestCallback(avConfig, avRecorder, recorderTime, done) {
let totalTime = 0; let totalTime = 0;
for(var i = 0;i < 10;i++){ for(var i = 0;i < 10;i++){
avRecorder = await idleCallBack(avRecorder); avRecorder = await idle(avRecorder);
await sleep(20) await sleep(20)
await avRecorder.prepare(avConfig).then(() => { await avRecorder.prepare(avConfig).then(() => {
expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.PREPARED); expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.PREPARED);
...@@ -2507,7 +2521,7 @@ export async function stopTimeTestCallback(avConfig, avRecorder, recorderTime, d ...@@ -2507,7 +2521,7 @@ export async function stopTimeTestCallback(avConfig, avRecorder, recorderTime, d
export async function resetTimeTestCallback(avConfig, avRecorder, recorderTime, done) { export async function resetTimeTestCallback(avConfig, avRecorder, recorderTime, done) {
let totalTime = 0; let totalTime = 0;
for(var i = 0;i < 10;i++){ for(var i = 0;i < 10;i++){
avRecorder = await idleCallBack(avRecorder); avRecorder = await idle(avRecorder);
await sleep(20) await sleep(20)
await avRecorder.prepare(avConfig).then(() => { await avRecorder.prepare(avConfig).then(() => {
expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.PREPARED); expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.PREPARED);
...@@ -2547,7 +2561,7 @@ export async function resetTimeTestCallback(avConfig, avRecorder, recorderTime, ...@@ -2547,7 +2561,7 @@ export async function resetTimeTestCallback(avConfig, avRecorder, recorderTime,
export async function releaseTimeTestCallback(avConfig, avRecorder, recorderTime, done) { export async function releaseTimeTestCallback(avConfig, avRecorder, recorderTime, done) {
let totalTime = 0; let totalTime = 0;
for(var i = 0;i < 10;i++){ for(var i = 0;i < 10;i++){
avRecorder = await idleCallBack(avRecorder); avRecorder = await idle(avRecorder);
await sleep(20) await sleep(20)
await avRecorder.prepare(avConfig).then(() => { await avRecorder.prepare(avConfig).then(() => {
expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.PREPARED); expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.PREPARED);
......
...@@ -21,109 +21,6 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from ...@@ -21,109 +21,6 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from
export default function avRecorderTest() { export default function avRecorderTest() {
describe('avRecorderTest', function () { describe('avRecorderTest', function () {
let avRecorder = null; let avRecorder = null;
const AV_SOURCES = [
'audio_1.m4a',
'audio_2.m4a',
'audio_3.m4a',
'audio_4.m4a',
'audio_5.m4a',
'audio_6.m4a',
'audio_7.m4a',
'audio_8.m4a',
'audio_9.m4a',
'audio_10.m4a',
'audio_11.m4a',
'audio_12.m4a',
'audio_13.m4a',
'audio_14.m4a',
'audio_15.m4a',
'audio_16.m4a',
'audio_17.m4a',
'audio_18.m4a',
'audio_19.m4a',
'audio_20.m4a',
'audio_21.m4a',
'audio_22.m4a',
'audio_23.m4a',
'audio_24.m4a',
'audio_25.m4a',
'audio_26.m4a',
'audio_27.m4a',
'audio_28.m4a',
'audio_29.m4a',
'audio_30.m4a',
'audio_31.m4a',
'audio_32.m4a',
'audio_33.m4a',
'audio_34.m4a',
'audio_35.m4a',
'audio_36.m4a',
'audio_37.m4a',
'audio_38.m4a',
'audio_39.m4a',
'audio_40.m4a',
'audio_41.m4a',
'audio_42.m4a',
'audio_43.m4a',
'av_audio_n1.m4a',
'av_audio_n2.m4a',
'av_audio_n3.m4a',
'av_audio_n4.m4a',
'av_audio_n5.m4a',
'av_audio_n6.m4a',
'av_audio_n7.m4a',
'av_audio_n8.m4a',
'av_audio_n9.m4a',
'av_audio_n10.m4a',
'av_audio_n11.m4a',
'av_audio_n12.m4a',
'av_audio_n13.m4a',
'av_audio_n14.m4a',
'av_audio_n15.m4a',
'av_audio_n16.m4a',
'av_audio_n17.m4a',
'av_audio_n18.m4a',
'av_audio_n19.m4a',
'av_audio_n20.m4a',
'av_audio_n21.m4a',
'av_audio_n22.m4a',
'av_audio_n23.m4a',
'av_audio_n24.m4a',
'av_audio_n25.m4a',
'av_audio_n26.m4a',
'av_audio_n27.m4a',
'av_audio_n28.m4a',
'av_audio_n29.m4a',
'av_audio_n30.m4a',
'av_audio_n31.m4a',
'av_audio_n32.m4a',
'av_audio_n33.m4a',
'av_audio_n34.m4a',
'av_audio_n35.m4a',
'av_audio_n36.m4a',
'av_audio_n37.m4a',
'av_audio_n38.m4a',
'av_audio_n39.m4a',
'av_audio_n40.m4a',
'av_audio_n41.m4a',
'av_audio_n42.m4a',
'av_audio_n43.m4a',
'av_audio_n44.m4a',
'av_audio_n45.m4a',
'av_audio_n46.m4a',
'av_audio_n47.m4a',
'av_audio_n48.m4a',
'av_audio_n49.m4a',
'av_audio_n50.m4a',
'av_audio_n51.m4a',
'av_audio_n52.m4a',
'av_audio_n53.m4a',
'av_audio_n54.m4a',
'av_audio_n55.m4a',
'av_audio_n56.m4a'
]
const RECORDER_TIME = 3000; const RECORDER_TIME = 3000;
const RECORDER_LONG_TIME = 3600000; const RECORDER_LONG_TIME = 3600000;
const LOOP_TIMES = 1000; const LOOP_TIMES = 1000;
...@@ -158,8 +55,8 @@ export default function avRecorderTest() { ...@@ -158,8 +55,8 @@ export default function avRecorderTest() {
let permissionName4 = 'ohos.permission.WRITE_MEDIA'; let permissionName4 = 'ohos.permission.WRITE_MEDIA';
let permissionNames = [permissionName1, permissionName2, permissionName3, permissionName4]; let permissionNames = [permissionName1, permissionName2, permissionName3, permissionName4];
await mediaTestBase.getPermission(permissionNames); await mediaTestBase.getPermission(permissionNames);
await mediaTestBase.msleepAsync(2000);
await mediaTestBase.driveFn(2) await mediaTestBase.driveFn(2)
await mediaTestBase.msleepAsync(3000);
console.info('beforeAll out'); console.info('beforeAll out');
}) })
...@@ -194,7 +91,8 @@ export default function avRecorderTest() { ...@@ -194,7 +91,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_AUDIO_FUNCTION_0100', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_AUDIO_FUNCTION_0100', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_AUDIO_FUNCTION_0100 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_AUDIO_FUNCTION_0100 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[0], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.avRecorderWithCallBack(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.avRecorderWithCallBack(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -211,13 +109,32 @@ export default function avRecorderTest() { ...@@ -211,13 +109,32 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0100', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0100', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0100 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0100 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[43], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.avRecorderReliabilitTest01(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.avRecorderReliabilitTest01(avConfig, avRecorder, RECORDER_TIME, done);
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0100 end') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0100 end')
}) })
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_AUDIO_FUNCTION_0101
* @tc.name : 001.test pause
* @tc.desc : Recorder audio 001.pause
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_AUDIO_FUNCTION_0101', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_AUDIO_FUNCTION_0101 start')
let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
avRecorderTestBase.avRecorderReliabilitTest001(avConfig, avRecorder, RECORDER_TIME, done);
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_AUDIO_FUNCTION_0101 end')
})
/* * /* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0200 * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0200
* @tc.name : 001.test channel * @tc.name : 001.test channel
...@@ -228,7 +145,8 @@ export default function avRecorderTest() { ...@@ -228,7 +145,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0200', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0200', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0200 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0200 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[44], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.avRecorderReliabilitTest02(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.avRecorderReliabilitTest02(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -245,7 +163,8 @@ export default function avRecorderTest() { ...@@ -245,7 +163,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0300', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0300', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0300 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0300 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[45], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.avRecorderReliabilitTest03(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.avRecorderReliabilitTest03(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -262,7 +181,8 @@ export default function avRecorderTest() { ...@@ -262,7 +181,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0400', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0400', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0400 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0400 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[46], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.avRecorderReliabilitTest04(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.avRecorderReliabilitTest04(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -279,7 +199,8 @@ export default function avRecorderTest() { ...@@ -279,7 +199,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0500', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0500', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0500 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0500 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[47], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.avRecorderReliabilitTest05(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.avRecorderReliabilitTest05(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -296,7 +217,8 @@ export default function avRecorderTest() { ...@@ -296,7 +217,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_START_API_0600', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_START_API_0600', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_START_API_0600 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_START_API_0600 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[48], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.avRecorderReliabilitTest06(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.avRecorderReliabilitTest06(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -313,7 +235,8 @@ export default function avRecorderTest() { ...@@ -313,7 +235,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_START_API_0700', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_START_API_0700', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_START_API_0700 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_START_API_0700 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[49], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.avRecorderReliabilitTest07(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.avRecorderReliabilitTest07(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -329,8 +252,8 @@ export default function avRecorderTest() { ...@@ -329,8 +252,8 @@ export default function avRecorderTest() {
* @tc.level : Level2 * @tc.level : Level2
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_0800', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_0800', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_0800 start') let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[50], "audio"); fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.avRecorderReliabilitTest08(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.avRecorderReliabilitTest08(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -347,7 +270,8 @@ export default function avRecorderTest() { ...@@ -347,7 +270,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_START_API_0900', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_START_API_0900', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_START_API_0900 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_START_API_0900 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[51], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.avRecorderReliabilitTest09(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.avRecorderReliabilitTest09(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -364,7 +288,8 @@ export default function avRecorderTest() { ...@@ -364,7 +288,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1000', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1000', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1000 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1000 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[52], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.avRecorderReliabilitTest10(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.avRecorderReliabilitTest10(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -381,7 +306,8 @@ export default function avRecorderTest() { ...@@ -381,7 +306,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1100', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1100', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1100 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1100 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[53], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.avRecorderReliabilitTest11(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.avRecorderReliabilitTest11(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -398,7 +324,8 @@ export default function avRecorderTest() { ...@@ -398,7 +324,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1200', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1200', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1200 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1200 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[54], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.avRecorderReliabilitTest12(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.avRecorderReliabilitTest12(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -415,7 +342,8 @@ export default function avRecorderTest() { ...@@ -415,7 +342,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1300', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1300', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1300 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1300 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[55], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.avRecorderReliabilitTest13(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.avRecorderReliabilitTest13(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -432,7 +360,8 @@ export default function avRecorderTest() { ...@@ -432,7 +360,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1400', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1400', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1400 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1400 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[56], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.avRecorderReliabilitTest14(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.avRecorderReliabilitTest14(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -449,7 +378,8 @@ export default function avRecorderTest() { ...@@ -449,7 +378,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1500', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1500', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1500 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PAUSE_API_1500 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[57], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.avRecorderReliabilitTest15(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.avRecorderReliabilitTest15(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -466,7 +396,8 @@ export default function avRecorderTest() { ...@@ -466,7 +396,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_1600', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_1600', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_1600 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_1600 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[58], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.avRecorderReliabilitTest16(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.avRecorderReliabilitTest16(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -483,7 +414,8 @@ export default function avRecorderTest() { ...@@ -483,7 +414,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_1700', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_1700', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_1700 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_1700 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[59], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.avRecorderReliabilitTest17(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.avRecorderReliabilitTest17(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -500,7 +432,8 @@ export default function avRecorderTest() { ...@@ -500,7 +432,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_1800', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_1800', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_1800 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_1800 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[60], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.avRecorderReliabilitTest18(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.avRecorderReliabilitTest18(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -517,7 +450,8 @@ export default function avRecorderTest() { ...@@ -517,7 +450,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_1900', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_1900', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_1900 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_1900 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[61], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.avRecorderReliabilitTest19(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.avRecorderReliabilitTest19(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -534,7 +468,8 @@ export default function avRecorderTest() { ...@@ -534,7 +468,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_2000', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_2000', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_2000 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_2000 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[62], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.avRecorderReliabilitTest20(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.avRecorderReliabilitTest20(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -551,7 +486,8 @@ export default function avRecorderTest() { ...@@ -551,7 +486,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_2100', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_2100', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_2100 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_2100 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[63], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.avRecorderReliabilitTest21(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.avRecorderReliabilitTest21(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -568,7 +504,8 @@ export default function avRecorderTest() { ...@@ -568,7 +504,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_2200', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_2200', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_2200 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_2200 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[64], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.avRecorderReliabilitTest22(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.avRecorderReliabilitTest22(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -585,7 +522,8 @@ export default function avRecorderTest() { ...@@ -585,7 +522,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_2300', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_2300', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_2300 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESUME_API_2300 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[65], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.avRecorderReliabilitTest23(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.avRecorderReliabilitTest23(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -602,7 +540,8 @@ export default function avRecorderTest() { ...@@ -602,7 +540,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_STOP_API_2400', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_STOP_API_2400', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_STOP_API_2400 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_STOP_API_2400 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[66], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.avRecorderReliabilitTest24(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.avRecorderReliabilitTest24(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -619,7 +558,8 @@ export default function avRecorderTest() { ...@@ -619,7 +558,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_STOP_API_2500', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_STOP_API_2500', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_STOP_API_2500 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_STOP_API_2500 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[67], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.avRecorderReliabilitTest25(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.avRecorderReliabilitTest25(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -636,7 +576,8 @@ export default function avRecorderTest() { ...@@ -636,7 +576,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESET_API_2600', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESET_API_2600', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESET_API_2600 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESET_API_2600 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[68], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.avRecorderReliabilitTest26(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.avRecorderReliabilitTest26(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -653,7 +594,8 @@ export default function avRecorderTest() { ...@@ -653,7 +594,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESET_API_2700', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESET_API_2700', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESET_API_2700 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RESET_API_2700 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[69], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.avRecorderReliabilitTest27(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.avRecorderReliabilitTest27(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -670,7 +612,8 @@ export default function avRecorderTest() { ...@@ -670,7 +612,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_RELEASE_API_2800', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_RELEASE_API_2800', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RELEASE_API_2800 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RELEASE_API_2800 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[70], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.avRecorderReliabilitTest28(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.avRecorderReliabilitTest28(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -687,7 +630,8 @@ export default function avRecorderTest() { ...@@ -687,7 +630,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_RELEASE_API_2900', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_RELEASE_API_2900', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RELEASE_API_2900 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RELEASE_API_2900 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[71], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.avRecorderReliabilitTest29(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.avRecorderReliabilitTest29(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -704,7 +648,8 @@ export default function avRecorderTest() { ...@@ -704,7 +648,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_RELEASE_API_3000', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_RELEASE_API_3000', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RELEASE_API_3000 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_RELEASE_API_3000 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[72], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.avRecorderReliabilitTest30(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.avRecorderReliabilitTest30(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -721,7 +666,8 @@ export default function avRecorderTest() { ...@@ -721,7 +666,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3100', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3100', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3100 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3100 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[73], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.avRecorderReliabilitTest31(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.avRecorderReliabilitTest31(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -738,7 +684,8 @@ export default function avRecorderTest() { ...@@ -738,7 +684,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3200', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3200', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3200 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3200 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[74], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.avRecorderReliabilitTest32(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.avRecorderReliabilitTest32(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -755,7 +702,8 @@ export default function avRecorderTest() { ...@@ -755,7 +702,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3300', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3300', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3300 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3300 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[75], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.avRecorderReliabilitTest33(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.avRecorderReliabilitTest33(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -772,7 +720,8 @@ export default function avRecorderTest() { ...@@ -772,7 +720,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3400', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3400', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3400 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3400 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[76], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.avRecorderReliabilitTest34(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.avRecorderReliabilitTest34(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -789,7 +738,8 @@ export default function avRecorderTest() { ...@@ -789,7 +738,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3500', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3500', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3500 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3500 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[77], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.avRecorderReliabilitTest35(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.avRecorderReliabilitTest35(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -806,7 +756,8 @@ export default function avRecorderTest() { ...@@ -806,7 +756,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3600', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3600', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3600 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3600 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[78], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.avRecorderReliabilitTest36(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.avRecorderReliabilitTest36(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -823,7 +774,8 @@ export default function avRecorderTest() { ...@@ -823,7 +774,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3700', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3700', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3700 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3700 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[79], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.avRecorderReliabilitTest37(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.avRecorderReliabilitTest37(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -840,7 +792,8 @@ export default function avRecorderTest() { ...@@ -840,7 +792,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3800', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3800', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3800 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_GETINPUTSURFACE_API_3800 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[80], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.avRecorderReliabilitTest38(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.avRecorderReliabilitTest38(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -857,7 +810,8 @@ export default function avRecorderTest() { ...@@ -857,7 +810,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0100', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0100', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0100 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0100 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[81], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.createTimeTestCallback(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.createTimeTestCallback(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -874,7 +828,8 @@ export default function avRecorderTest() { ...@@ -874,7 +828,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0200', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0200', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0200 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0200 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[82], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.prepareTimeCallback(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.prepareTimeCallback(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -891,7 +846,8 @@ export default function avRecorderTest() { ...@@ -891,7 +846,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0300', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0300', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0300 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0300 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[83], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.getInputSurfaceTimeTestCallback(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.getInputSurfaceTimeTestCallback(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -908,7 +864,8 @@ export default function avRecorderTest() { ...@@ -908,7 +864,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0400', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0400', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0400 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0400 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[84], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.startTimeTestCallback(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.startTimeTestCallback(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -925,7 +882,8 @@ export default function avRecorderTest() { ...@@ -925,7 +882,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0500', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0500', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0500 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0500 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[85], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.pauseTimeTestCallback(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.pauseTimeTestCallback(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -942,7 +900,8 @@ export default function avRecorderTest() { ...@@ -942,7 +900,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0600', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0600', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0600 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0600 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[86], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.resumeTimeTestCallback(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.resumeTimeTestCallback(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -959,7 +918,8 @@ export default function avRecorderTest() { ...@@ -959,7 +918,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0700', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0700', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0700 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0700 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[87], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.stopTimeTestCallback(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.stopTimeTestCallback(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -976,7 +936,8 @@ export default function avRecorderTest() { ...@@ -976,7 +936,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0800', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0800', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0800 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0800 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[88], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.resetTimeTestCallback(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.resetTimeTestCallback(avConfig, avRecorder, RECORDER_TIME, done);
...@@ -993,7 +954,8 @@ export default function avRecorderTest() { ...@@ -993,7 +954,8 @@ export default function avRecorderTest() {
*/ */
it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0900', 0, async function (done) { it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0900', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0900 start') console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PERFORMANCE_CALLBACK_01_0900 start')
fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[89], "audio"); let fileName = avRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "audio");
fdPath = "fd://" + fdObject.fdNumber; fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath; avConfig.url = fdPath;
avRecorderTestBase.releaseTimeTestCallback(avConfig, avRecorder, RECORDER_TIME, done); avRecorderTestBase.releaseTimeTestCallback(avConfig, avRecorder, RECORDER_TIME, done);
......
...@@ -418,6 +418,8 @@ export default function ActsCommonEventManagerSupportTest() { ...@@ -418,6 +418,8 @@ export default function ActsCommonEventManagerSupportTest() {
expect(commonEventManager.Support.COMMON_EVENT_STK_CARD_STATE_CHANGED).assertEqual('usual.event.STK_CARD_STATE_CHANGED') expect(commonEventManager.Support.COMMON_EVENT_STK_CARD_STATE_CHANGED).assertEqual('usual.event.STK_CARD_STATE_CHANGED')
expect(commonEventManager.Support.COMMON_EVENT_STK_ALPHA_IDENTIFIER).assertEqual('usual.event.STK_ALPHA_IDENTIFIER') expect(commonEventManager.Support.COMMON_EVENT_STK_ALPHA_IDENTIFIER).assertEqual('usual.event.STK_ALPHA_IDENTIFIER')
expect(commonEventManager.Support.COMMON_EVENT_RADIO_STATE_CHANGE).assertEqual('usual.event.RADIO_STATE_CHANGE') expect(commonEventManager.Support.COMMON_EVENT_RADIO_STATE_CHANGE).assertEqual('usual.event.RADIO_STATE_CHANGE')
expect(commonEventManager.Support.COMMON_EVENT_SCREEN_UNLOCKED).assertEqual('usual.event.SCREEN_UNLOCKED')
expect(commonEventManager.Support.COMMON_EVENT_SCREEN_LOCKED).assertEqual('usual.event.SCREEN_LOCKED')
console.info(`${TAG} SUB_NOTIFICATION_CES_MANAGER_SUPPORT_ENUM_TEST_2200 END`) console.info(`${TAG} SUB_NOTIFICATION_CES_MANAGER_SUPPORT_ENUM_TEST_2200 END`)
}) })
......
...@@ -70,4 +70,48 @@ describe('SUB_NOTIFICATION_CES_SYSTEM_API_TEST', function () { ...@@ -70,4 +70,48 @@ describe('SUB_NOTIFICATION_CES_SYSTEM_API_TEST', function () {
console.info(`${TAG} SUB_NOTIFICATION_CES_SYSTEM_API_TEST_0200 END`); console.info(`${TAG} SUB_NOTIFICATION_CES_SYSTEM_API_TEST_0200 END`);
}); });
/*
* @tc.number: SUB_NOTIFICATION_CES_SYSTEM_API_TEST_0300
* @tc.name: removeStickyCommonEvent
* @tc.desc: test function removeStickyCommonEvent
*/
it('SUB_NOTIFICATION_CES_SYSTEM_API_TEST_0300', 0, async function (done) {
console.info(`${TAG} SUB_NOTIFICATION_CES_SYSTEM_API_TEST_0300 START`);
commonEventManager.removeStickyCommonEvent("sticky_event", (err) => {
if (err) {
console.info(`${TAG} remove sticky event AsyncCallback errCode: ${err.code}, errMes: ${err.message}`)
expect(err.code).assertEqual(202);
done()
} else {
console.info("${TAG} remove sticky event AsyncCallback success");
expect(false).assertTrue()
done()
}
});
console.info(`${TAG} SUB_NOTIFICATION_CES_SYSTEM_API_TEST_0300 END`);
});
/*
* @tc.number: SUB_NOTIFICATION_CES_SYSTEM_API_TEST_0400
* @tc.name: removeStickyCommonEvent
* @tc.desc: test function removeStickyCommonEvent
*/
it('SUB_NOTIFICATION_CES_SYSTEM_API_TEST_0400', 0, async function (done) {
console.info(`${TAG} SUB_NOTIFICATION_CES_SYSTEM_API_TEST_0400 START`);
commonEventManager.removeStickyCommonEvent("sticky_event").then(() => {
console.info("${TAG} remove sticky event AsyncCallback success");
expect(false).assertTrue()
done()
}).catch ((err) => {
console.info(`${TAG} remove sticky event AsyncCallback errCode: ${err.code}, errMes: ${err.message}`)
expect(err.code).assertEqual(202);
done()
});
console.info(`${TAG} SUB_NOTIFICATION_CES_SYSTEM_API_TEST_0400 END`);
});
}) } }) }
\ No newline at end of file
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
"bundle-name": "com.acts.request.test", "bundle-name": "com.acts.request.test",
"module-name": "entry_test", "module-name": "entry_test",
"shell-timeout": "180000", "shell-timeout": "180000",
"testcase-timeout": 600000 "testcase-timeout": 15000
}, },
"kits": [{ "kits": [{
"test-file-name": [ "test-file-name": [
......
...@@ -37,6 +37,7 @@ describe('fileIO_fs_close', function () { ...@@ -37,6 +37,7 @@ describe('fileIO_fs_close', function () {
try { try {
let file = fileIO.openSync(fpath, fileIO.OpenMode.READ_WRITE); let file = fileIO.openSync(fpath, fileIO.OpenMode.READ_WRITE);
fileIO.closeSync(file.fd); fileIO.closeSync(file.fd);
fileIO.closeSync(file);
fileIO.unlinkSync(fpath); fileIO.unlinkSync(fpath);
} catch (e) { } catch (e) {
console.log('fileIO_test_close_sync_000 has failed for ' + e.message + ', code: ' + e.code); console.log('fileIO_test_close_sync_000 has failed for ' + e.message + ', code: ' + e.code);
...@@ -82,8 +83,9 @@ describe('fileIO_fs_close', function () { ...@@ -82,8 +83,9 @@ describe('fileIO_fs_close', function () {
try { try {
let file = fileIO.openSync(fpath, fileIO.OpenMode.READ_WRITE); let file = fileIO.openSync(fpath, fileIO.OpenMode.READ_WRITE);
fileIO.closeSync(file.fd); let fd = file.fd;
fileIO.closeSync(file.fd); fileIO.closeSync(file);
fileIO.closeSync(fd);
expect(false).assertTrue(); expect(false).assertTrue();
} catch (e) { } catch (e) {
fileIO.unlinkSync(fpath); fileIO.unlinkSync(fpath);
...@@ -181,6 +183,7 @@ describe('fileIO_fs_close', function () { ...@@ -181,6 +183,7 @@ describe('fileIO_fs_close', function () {
console.log('fileIO_test_close_async_000 error package: ' + JSON.stringify(err)); console.log('fileIO_test_close_async_000 error package: ' + JSON.stringify(err));
expect(false).assertTrue(); expect(false).assertTrue();
} }
fileIO.closeSync(file);
fileIO.unlinkSync(fpath); fileIO.unlinkSync(fpath);
done(); done();
}); });
...@@ -207,7 +210,7 @@ describe('fileIO_fs_close', function () { ...@@ -207,7 +210,7 @@ describe('fileIO_fs_close', function () {
try { try {
let file = fileIO.openSync(fpath, fileIO.OpenMode.READ_WRITE); let file = fileIO.openSync(fpath, fileIO.OpenMode.READ_WRITE);
fileIO.close(file, (err) => { fileIO.close(file, (err) => {
if(err) { if (err) {
console.log('fileIO_test_close_async_001 error package: ' + JSON.stringify(err)); console.log('fileIO_test_close_async_001 error package: ' + JSON.stringify(err));
expect(false).assertTrue(); expect(false).assertTrue();
} }
...@@ -237,6 +240,7 @@ describe('fileIO_fs_close', function () { ...@@ -237,6 +240,7 @@ describe('fileIO_fs_close', function () {
try { try {
let file = fileIO.openSync(fpath, fileIO.OpenMode.READ_WRITE); let file = fileIO.openSync(fpath, fileIO.OpenMode.READ_WRITE);
await fileIO.close(file.fd); await fileIO.close(file.fd);
await fileIO.close(file);
fileIO.unlinkSync(fpath); fileIO.unlinkSync(fpath);
done(); done();
} catch (e) { } catch (e) {
...@@ -286,8 +290,9 @@ describe('fileIO_fs_close', function () { ...@@ -286,8 +290,9 @@ describe('fileIO_fs_close', function () {
try { try {
let file = fileIO.openSync(fpath, fileIO.OpenMode.READ_WRITE); let file = fileIO.openSync(fpath, fileIO.OpenMode.READ_WRITE);
await fileIO.close(file.fd); let fd = file.fd;
await fileIO.close(file.fd); await fileIO.close(file);
await fileIO.close(fd);
expect(false).assertTrue(); expect(false).assertTrue();
} catch (e) { } catch (e) {
fileIO.unlinkSync(fpath); fileIO.unlinkSync(fpath);
...@@ -337,12 +342,13 @@ describe('fileIO_fs_close', function () { ...@@ -337,12 +342,13 @@ describe('fileIO_fs_close', function () {
it('fileIO_test_close_async_006', 0, async function (done) { it('fileIO_test_close_async_006', 0, async function (done) {
let fpath = await nextFileName('fileIO_test_close_async_006'); let fpath = await nextFileName('fileIO_test_close_async_006');
expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); expect(prepareFile(fpath, FILE_CONTENT)).assertTrue();
let file = fileIO.openSync(fpath, fileIO.OpenMode.READ_WRITE);
try { try {
let file = fileIO.openSync(fpath, fileIO.OpenMode.READ_WRITE);
await fileIO.close(file.fd, 2); await fileIO.close(file.fd, 2);
expect(false).assertTrue(); expect(false).assertTrue();
} catch (e) { } catch (e) {
fileIO.closeSync(file);
fileIO.unlinkSync(fpath); fileIO.unlinkSync(fpath);
console.log('fileIO_test_close_async_006 has failed for ' + e.message + ', code: ' + e.code); console.log('fileIO_test_close_async_006 has failed for ' + e.message + ', code: ' + e.code);
expect(e.code == 13900020 && e.message == 'Invalid argument').assertTrue(); expect(e.code == 13900020 && e.message == 'Invalid argument').assertTrue();
......
...@@ -44,6 +44,7 @@ describe('fileIO_fs_FdOpenStream', async function () { ...@@ -44,6 +44,7 @@ describe('fileIO_fs_FdOpenStream', async function () {
expect(false).assertTrue(); expect(false).assertTrue();
} catch (e) { } catch (e) {
fpr.closeSync(); fpr.closeSync();
fileIO.closeSync(file);
fileIO.unlinkSync(fpath); fileIO.unlinkSync(fpath);
console.log('fileIO_test_fdopenstream_sync_000 has failed for ' + e.message + ', code: ' + e.code); console.log('fileIO_test_fdopenstream_sync_000 has failed for ' + e.message + ', code: ' + e.code);
expect(e.code == 13900005 && e.message == 'I/O error').assertTrue(); expect(e.code == 13900005 && e.message == 'I/O error').assertTrue();
...@@ -93,6 +94,7 @@ describe('fileIO_fs_FdOpenStream', async function () { ...@@ -93,6 +94,7 @@ describe('fileIO_fs_FdOpenStream', async function () {
expect(fpr.readSync(new ArrayBuffer(4096)) == FILE_CONTENT.length).assertTrue(); expect(fpr.readSync(new ArrayBuffer(4096)) == FILE_CONTENT.length).assertTrue();
expect(fpr.writeSync(FILE_CONTENT) == FILE_CONTENT.length).assertTrue(); expect(fpr.writeSync(FILE_CONTENT) == FILE_CONTENT.length).assertTrue();
fpr.closeSync(); fpr.closeSync();
fileIO.closeSync(file);
fileIO.unlinkSync(fpath); fileIO.unlinkSync(fpath);
} catch (e) { } catch (e) {
console.log('fileIO_test_fdopenstream_sync_002 has failed for ' + e.message + ', code: ' + e.code); console.log('fileIO_test_fdopenstream_sync_002 has failed for ' + e.message + ', code: ' + e.code);
...@@ -141,6 +143,8 @@ describe('fileIO_fs_FdOpenStream', async function () { ...@@ -141,6 +143,8 @@ describe('fileIO_fs_FdOpenStream', async function () {
fileIO.fdopenStreamSync(file.fd, 'ohos'); fileIO.fdopenStreamSync(file.fd, 'ohos');
expect(false).assertTrue(); expect(false).assertTrue();
} catch (e) { } catch (e) {
fileIO.closeSync(file);
fileIO.unlinkSync(fpath);
console.log('fileIO_test_fdopenstream_sync_004 has failed for ' + e.message + ', code: ' + e.code); console.log('fileIO_test_fdopenstream_sync_004 has failed for ' + e.message + ', code: ' + e.code);
expect(e.code == 13900020 && e.message == 'Invalid argument').assertTrue(); expect(e.code == 13900020 && e.message == 'Invalid argument').assertTrue();
} }
...@@ -166,6 +170,8 @@ describe('fileIO_fs_FdOpenStream', async function () { ...@@ -166,6 +170,8 @@ describe('fileIO_fs_FdOpenStream', async function () {
fileIO.fdopenStreamSync(file.fd); fileIO.fdopenStreamSync(file.fd);
expect(false).assertTrue(); expect(false).assertTrue();
} catch (e) { } catch (e) {
fileIO.closeSync(file);
fileIO.unlinkSync(fpath);
console.log('fileIO_test_fdopenstream_sync_005 has failed for ' + e.message + ', code: ' + e.code); console.log('fileIO_test_fdopenstream_sync_005 has failed for ' + e.message + ', code: ' + e.code);
expect(e.code == 13900020 && e.message == 'Invalid argument').assertTrue(); expect(e.code == 13900020 && e.message == 'Invalid argument').assertTrue();
} }
...@@ -195,6 +201,7 @@ describe('fileIO_fs_FdOpenStream', async function () { ...@@ -195,6 +201,7 @@ describe('fileIO_fs_FdOpenStream', async function () {
expect(false).assertTrue(); expect(false).assertTrue();
} catch (e) { } catch (e) {
fpw.closeSync(); fpw.closeSync();
fileIO.closeSync(file);
fileIO.unlinkSync(fpath); fileIO.unlinkSync(fpath);
console.log('fileIO_test_fdopenstream_sync_006 has failed for ' + e.message + ', code: ' + e.code); console.log('fileIO_test_fdopenstream_sync_006 has failed for ' + e.message + ', code: ' + e.code);
expect(e.code == 13900005 && e.message == 'I/O error').assertTrue(); expect(e.code == 13900005 && e.message == 'I/O error').assertTrue();
...@@ -227,6 +234,8 @@ describe('fileIO_fs_FdOpenStream', async function () { ...@@ -227,6 +234,8 @@ describe('fileIO_fs_FdOpenStream', async function () {
let fpr = fileIO.fdopenStreamSync(file2.fd, 'r'); let fpr = fileIO.fdopenStreamSync(file2.fd, 'r');
expect(fpr.readSync(new ArrayBuffer(4096)) == FILE_CONTENT.length).assertTrue(); expect(fpr.readSync(new ArrayBuffer(4096)) == FILE_CONTENT.length).assertTrue();
fpr.closeSync(); fpr.closeSync();
fileIO.closeSync(file1);
fileIO.closeSync(file2);
fileIO.unlinkSync(fpath); fileIO.unlinkSync(fpath);
} catch (e) { } catch (e) {
console.log('fileIO_test_fdopenstream_sync_007 has failed for ' + e.message + ', code: ' + e.code); console.log('fileIO_test_fdopenstream_sync_007 has failed for ' + e.message + ', code: ' + e.code);
...@@ -256,6 +265,7 @@ describe('fileIO_fs_FdOpenStream', async function () { ...@@ -256,6 +265,7 @@ describe('fileIO_fs_FdOpenStream', async function () {
expect(fpw.writeSync(FILE_CONTENT) == FILE_CONTENT.length).assertTrue(); expect(fpw.writeSync(FILE_CONTENT) == FILE_CONTENT.length).assertTrue();
expect(fpw.readSync(new ArrayBuffer(4096)) == FILE_CONTENT.length).assertTrue(); expect(fpw.readSync(new ArrayBuffer(4096)) == FILE_CONTENT.length).assertTrue();
fpw.closeSync(); fpw.closeSync();
fileIO.closeSync(file);
fileIO.unlinkSync(fpath); fileIO.unlinkSync(fpath);
} catch (e) { } catch (e) {
console.log('fileIO_test_fdopenstream_sync_008 has failed for ' + e.message + ', code: ' + e.code); console.log('fileIO_test_fdopenstream_sync_008 has failed for ' + e.message + ', code: ' + e.code);
...@@ -289,6 +299,8 @@ describe('fileIO_fs_FdOpenStream', async function () { ...@@ -289,6 +299,8 @@ describe('fileIO_fs_FdOpenStream', async function () {
let fpr = fileIO.fdopenStreamSync(file2.fd, 'r'); let fpr = fileIO.fdopenStreamSync(file2.fd, 'r');
expect(fpr.readSync(new ArrayBuffer(4096)) == FILE_CONTENT.length * 2).assertTrue(); expect(fpr.readSync(new ArrayBuffer(4096)) == FILE_CONTENT.length * 2).assertTrue();
fpr.closeSync(); fpr.closeSync();
fileIO.closeSync(file1);
fileIO.closeSync(file2);
fileIO.unlinkSync(fpath); fileIO.unlinkSync(fpath);
} catch (e) { } catch (e) {
console.log('fileIO_test_fdopenstream_sync_009 has failed for ' + e.message + ', code: ' + e.code); console.log('fileIO_test_fdopenstream_sync_009 has failed for ' + e.message + ', code: ' + e.code);
...@@ -320,6 +332,7 @@ describe('fileIO_fs_FdOpenStream', async function () { ...@@ -320,6 +332,7 @@ describe('fileIO_fs_FdOpenStream', async function () {
expect(false).assertTrue(); expect(false).assertTrue();
} catch (e) { } catch (e) {
fpa.closeSync(); fpa.closeSync();
fileIO.closeSync(file);
fileIO.unlinkSync(fpath); fileIO.unlinkSync(fpath);
console.log('fileIO_test_fdopenstream_sync_010 has failed for ' + e.message + ', code: ' + e.code); console.log('fileIO_test_fdopenstream_sync_010 has failed for ' + e.message + ', code: ' + e.code);
expect(e.code == 13900005 && e.message == 'I/O error').assertTrue(); expect(e.code == 13900005 && e.message == 'I/O error').assertTrue();
...@@ -348,6 +361,7 @@ describe('fileIO_fs_FdOpenStream', async function () { ...@@ -348,6 +361,7 @@ describe('fileIO_fs_FdOpenStream', async function () {
expect(fpa.writeSync(FILE_CONTENT) == FILE_CONTENT.length).assertTrue(); expect(fpa.writeSync(FILE_CONTENT) == FILE_CONTENT.length).assertTrue();
expect(fpa.readSync(new ArrayBuffer(4096)) == FILE_CONTENT.length * 2).assertTrue(); expect(fpa.readSync(new ArrayBuffer(4096)) == FILE_CONTENT.length * 2).assertTrue();
fpa.closeSync(); fpa.closeSync();
fileIO.closeSync(file);
fileIO.unlinkSync(fpath); fileIO.unlinkSync(fpath);
} catch (e) { } catch (e) {
console.log('fileIO_test_fdopenstream_sync_011 has failed for ' + e.message + ', code: ' + e.code); console.log('fileIO_test_fdopenstream_sync_011 has failed for ' + e.message + ', code: ' + e.code);
...@@ -379,6 +393,7 @@ describe('fileIO_fs_FdOpenStream', async function () { ...@@ -379,6 +393,7 @@ describe('fileIO_fs_FdOpenStream', async function () {
expect(false).assertTrue(); expect(false).assertTrue();
} catch (e) { } catch (e) {
fpr.closeSync(); fpr.closeSync();
fileIO.closeSync(file);
fileIO.unlinkSync(fpath); fileIO.unlinkSync(fpath);
console.log('fileIO_test_fdopenstream_async_000 has failed for ' + e.message + ', code: ' + e.code); console.log('fileIO_test_fdopenstream_async_000 has failed for ' + e.message + ', code: ' + e.code);
expect(e.code == 13900005 && e.message == 'I/O error').assertTrue(); expect(e.code == 13900005 && e.message == 'I/O error').assertTrue();
...@@ -413,6 +428,7 @@ describe('fileIO_fs_FdOpenStream', async function () { ...@@ -413,6 +428,7 @@ describe('fileIO_fs_FdOpenStream', async function () {
fpr.write(FILE_CONTENT, (err) => { fpr.write(FILE_CONTENT, (err) => {
if (err) { if (err) {
fpr.closeSync(); fpr.closeSync();
fileIO.closeSync(file);
fileIO.unlinkSync(fpath); fileIO.unlinkSync(fpath);
console.log( console.log(
'fileIO_test_fdopenstream_async_001 error: {message: ' + err.message + ', code: ' + err.code + '}' 'fileIO_test_fdopenstream_async_001 error: {message: ' + err.message + ', code: ' + err.code + '}'
...@@ -497,6 +513,7 @@ describe('fileIO_fs_FdOpenStream', async function () { ...@@ -497,6 +513,7 @@ describe('fileIO_fs_FdOpenStream', async function () {
expect(fpr.writeSync(FILE_CONTENT) == FILE_CONTENT.length).assertTrue(); expect(fpr.writeSync(FILE_CONTENT) == FILE_CONTENT.length).assertTrue();
expect(fpr.readSync(new ArrayBuffer(4096)) == FILE_CONTENT.length).assertTrue(); expect(fpr.readSync(new ArrayBuffer(4096)) == FILE_CONTENT.length).assertTrue();
fpr.closeSync(); fpr.closeSync();
fileIO.closeSync(file);
fileIO.unlinkSync(fpath); fileIO.unlinkSync(fpath);
done(); done();
} catch (e) { } catch (e) {
...@@ -531,6 +548,7 @@ describe('fileIO_fs_FdOpenStream', async function () { ...@@ -531,6 +548,7 @@ describe('fileIO_fs_FdOpenStream', async function () {
expect(fpr.writeSync(FILE_CONTENT) == FILE_CONTENT.length).assertTrue(); expect(fpr.writeSync(FILE_CONTENT) == FILE_CONTENT.length).assertTrue();
expect(fpr.readSync(new ArrayBuffer(4096)) == FILE_CONTENT.length).assertTrue(); expect(fpr.readSync(new ArrayBuffer(4096)) == FILE_CONTENT.length).assertTrue();
fpr.closeSync(); fpr.closeSync();
fileIO.closeSync(file);
fileIO.unlinkSync(fpath); fileIO.unlinkSync(fpath);
done(); done();
}); });
...@@ -560,6 +578,8 @@ describe('fileIO_fs_FdOpenStream', async function () { ...@@ -560,6 +578,8 @@ describe('fileIO_fs_FdOpenStream', async function () {
await fileIO.fdopenStream(file.fd, 'ohos'); await fileIO.fdopenStream(file.fd, 'ohos');
expect(false).assertTrue(); expect(false).assertTrue();
} catch (e) { } catch (e) {
fileIO.closeSync(file);
fileIO.unlinkSync(fpath);
console.log('fileIO_test_fdopenstream_async_006 has failed for ' + e.message + ', code: ' + e.code); console.log('fileIO_test_fdopenstream_async_006 has failed for ' + e.message + ', code: ' + e.code);
expect(e.code == 13900020 && e.message == 'Invalid argument').assertTrue(); expect(e.code == 13900020 && e.message == 'Invalid argument').assertTrue();
done(); done();
...@@ -586,6 +606,8 @@ describe('fileIO_fs_FdOpenStream', async function () { ...@@ -586,6 +606,8 @@ describe('fileIO_fs_FdOpenStream', async function () {
await fileIO.fdopenStream(file.fd); await fileIO.fdopenStream(file.fd);
expect(false).assertTrue(); expect(false).assertTrue();
} catch (e) { } catch (e) {
fileIO.closeSync(file);
fileIO.unlinkSync(fpath);
console.log('fileIO_test_fdopenstream_async_007 has failed for ' + e.message + ', code: ' + e.code); console.log('fileIO_test_fdopenstream_async_007 has failed for ' + e.message + ', code: ' + e.code);
expect(e.code == 13900020 && e.message == 'Invalid argument').assertTrue(); expect(e.code == 13900020 && e.message == 'Invalid argument').assertTrue();
done(); done();
...@@ -616,6 +638,7 @@ describe('fileIO_fs_FdOpenStream', async function () { ...@@ -616,6 +638,7 @@ describe('fileIO_fs_FdOpenStream', async function () {
expect(false).assertTrue(); expect(false).assertTrue();
} catch (e) { } catch (e) {
fpw.closeSync(); fpw.closeSync();
fileIO.closeSync(file);
fileIO.unlinkSync(fpath); fileIO.unlinkSync(fpath);
console.log('fileIO_test_fdopenstream_async_008 has failed for ' + e.message + ', code: ' + e.code); console.log('fileIO_test_fdopenstream_async_008 has failed for ' + e.message + ', code: ' + e.code);
expect(e.code == 13900005 && e.message == 'I/O error').assertTrue(); expect(e.code == 13900005 && e.message == 'I/O error').assertTrue();
...@@ -650,6 +673,7 @@ describe('fileIO_fs_FdOpenStream', async function () { ...@@ -650,6 +673,7 @@ describe('fileIO_fs_FdOpenStream', async function () {
fpw.read(new ArrayBuffer(4096), (err) => { fpw.read(new ArrayBuffer(4096), (err) => {
if (err) { if (err) {
fpw.closeSync(); fpw.closeSync();
fileIO.closeSync(file);
fileIO.unlinkSync(fpath); fileIO.unlinkSync(fpath);
console.log( console.log(
'fileIO_test_fdopenstream_async_009 error: {message: ' + err.message + ', code: ' + err.code + '}' 'fileIO_test_fdopenstream_async_009 error: {message: ' + err.message + ', code: ' + err.code + '}'
...@@ -692,6 +716,8 @@ describe('fileIO_fs_FdOpenStream', async function () { ...@@ -692,6 +716,8 @@ describe('fileIO_fs_FdOpenStream', async function () {
let fpr = await fileIO.fdopenStream(file2.fd, 'r'); let fpr = await fileIO.fdopenStream(file2.fd, 'r');
expect(fpr.readSync(new ArrayBuffer(4096)) == FILE_CONTENT.length).assertTrue(); expect(fpr.readSync(new ArrayBuffer(4096)) == FILE_CONTENT.length).assertTrue();
fpr.closeSync(); fpr.closeSync();
fileIO.closeSync(file1);
fileIO.closeSync(file2);
fileIO.unlinkSync(fpath); fileIO.unlinkSync(fpath);
done(); done();
} catch (e) { } catch (e) {
...@@ -722,6 +748,7 @@ describe('fileIO_fs_FdOpenStream', async function () { ...@@ -722,6 +748,7 @@ describe('fileIO_fs_FdOpenStream', async function () {
expect(fpw.writeSync(FILE_CONTENT) == FILE_CONTENT.length).assertTrue(); expect(fpw.writeSync(FILE_CONTENT) == FILE_CONTENT.length).assertTrue();
expect(fpw.readSync(new ArrayBuffer(4096)) == FILE_CONTENT.length).assertTrue(); expect(fpw.readSync(new ArrayBuffer(4096)) == FILE_CONTENT.length).assertTrue();
fpw.closeSync(); fpw.closeSync();
fileIO.closeSync(file);
fileIO.unlinkSync(fpath); fileIO.unlinkSync(fpath);
done(); done();
} catch (e) { } catch (e) {
...@@ -756,6 +783,7 @@ describe('fileIO_fs_FdOpenStream', async function () { ...@@ -756,6 +783,7 @@ describe('fileIO_fs_FdOpenStream', async function () {
expect(fpw.writeSync(FILE_CONTENT) == FILE_CONTENT.length).assertTrue(); expect(fpw.writeSync(FILE_CONTENT) == FILE_CONTENT.length).assertTrue();
expect(fpw.readSync(new ArrayBuffer(4096)) == FILE_CONTENT.length).assertTrue(); expect(fpw.readSync(new ArrayBuffer(4096)) == FILE_CONTENT.length).assertTrue();
fpw.closeSync(); fpw.closeSync();
fileIO.closeSync(file);
fileIO.unlinkSync(fpath); fileIO.unlinkSync(fpath);
done(); done();
}); });
...@@ -790,6 +818,8 @@ describe('fileIO_fs_FdOpenStream', async function () { ...@@ -790,6 +818,8 @@ describe('fileIO_fs_FdOpenStream', async function () {
let fpr = await fileIO.fdopenStream(file2.fd, 'r'); let fpr = await fileIO.fdopenStream(file2.fd, 'r');
expect(fpr.readSync(new ArrayBuffer(4096)) == FILE_CONTENT.length * 2).assertTrue(); expect(fpr.readSync(new ArrayBuffer(4096)) == FILE_CONTENT.length * 2).assertTrue();
fpr.closeSync(); fpr.closeSync();
fileIO.closeSync(file1);
fileIO.closeSync(file2);
fileIO.unlinkSync(fpath); fileIO.unlinkSync(fpath);
done(); done();
} catch (e) { } catch (e) {
...@@ -822,6 +852,7 @@ describe('fileIO_fs_FdOpenStream', async function () { ...@@ -822,6 +852,7 @@ describe('fileIO_fs_FdOpenStream', async function () {
expect(false).assertTrue(); expect(false).assertTrue();
} catch (e) { } catch (e) {
fpa.closeSync(); fpa.closeSync();
fileIO.closeSync(file);
fileIO.unlinkSync(fpath); fileIO.unlinkSync(fpath);
console.log('fileIO_test_fdopenstream_async_014 has failed for ' + e.message + ', code: ' + e.code); console.log('fileIO_test_fdopenstream_async_014 has failed for ' + e.message + ', code: ' + e.code);
expect(e.code == 13900005 && e.message == 'I/O error').assertTrue(); expect(e.code == 13900005 && e.message == 'I/O error').assertTrue();
...@@ -856,6 +887,7 @@ describe('fileIO_fs_FdOpenStream', async function () { ...@@ -856,6 +887,7 @@ describe('fileIO_fs_FdOpenStream', async function () {
fpa.read(new ArrayBuffer(4096), (err) => { fpa.read(new ArrayBuffer(4096), (err) => {
if (err) { if (err) {
fpa.closeSync(); fpa.closeSync();
fileIO.closeSync(file);
fileIO.unlinkSync(fpath); fileIO.unlinkSync(fpath);
console.log( console.log(
'fileIO_test_fdopenstream_async_015 error: {message: ' + err.message + ', code: ' + err.code + '}' 'fileIO_test_fdopenstream_async_015 error: {message: ' + err.message + ', code: ' + err.code + '}'
...@@ -895,6 +927,7 @@ describe('fileIO_fs_FdOpenStream', async function () { ...@@ -895,6 +927,7 @@ describe('fileIO_fs_FdOpenStream', async function () {
expect(fpa.writeSync(FILE_CONTENT) == FILE_CONTENT.length).assertTrue(); expect(fpa.writeSync(FILE_CONTENT) == FILE_CONTENT.length).assertTrue();
expect(fpa.readSync(new ArrayBuffer(4096)) == FILE_CONTENT.length * 2).assertTrue(); expect(fpa.readSync(new ArrayBuffer(4096)) == FILE_CONTENT.length * 2).assertTrue();
fpa.closeSync(); fpa.closeSync();
fileIO.closeSync(file);
fileIO.unlinkSync(fpath); fileIO.unlinkSync(fpath);
done(); done();
} catch (e) { } catch (e) {
...@@ -929,6 +962,7 @@ describe('fileIO_fs_FdOpenStream', async function () { ...@@ -929,6 +962,7 @@ describe('fileIO_fs_FdOpenStream', async function () {
expect(fpa.writeSync(FILE_CONTENT) == FILE_CONTENT.length).assertTrue(); expect(fpa.writeSync(FILE_CONTENT) == FILE_CONTENT.length).assertTrue();
expect(fpa.readSync(new ArrayBuffer(4096)) == FILE_CONTENT.length * 2).assertTrue(); expect(fpa.readSync(new ArrayBuffer(4096)) == FILE_CONTENT.length * 2).assertTrue();
fpa.closeSync(); fpa.closeSync();
fileIO.closeSync(file);
fileIO.unlinkSync(fpath); fileIO.unlinkSync(fpath);
done(); done();
}); });
......
...@@ -2304,7 +2304,7 @@ describe('fileIO_fs_stat', function () { ...@@ -2304,7 +2304,7 @@ describe('fileIO_fs_stat', function () {
let file2 = fileIO.openSync(fpath, fileIO.OpenMode.READ_WRITE); let file2 = fileIO.openSync(fpath, fileIO.OpenMode.READ_WRITE);
stat = fileIO.statSync(file2.fd); stat = fileIO.statSync(file2.fd);
expect(stat.size == FILE_CONTENT.length * 2).assertTrue(); expect(stat.size == FILE_CONTENT.length * 2).assertTrue();
fileIO.closeSync(file2.fd); fileIO.closeSync(file2);
fileIO.unlinkSync(fpath); fileIO.unlinkSync(fpath);
done(); done();
} catch (e) { } catch (e) {
......
...@@ -50,6 +50,7 @@ _all_test_packages = [ ...@@ -50,6 +50,7 @@ _all_test_packages = [
"${ACTS_ROOT}/wukong:wukong", "${ACTS_ROOT}/wukong:wukong",
"${ACTS_ROOT}/validator:validator", "${ACTS_ROOT}/validator:validator",
"${ACTS_ROOT}/xts:xts", "${ACTS_ROOT}/xts:xts",
"${ACTS_ROOT}/msdp:msdp",
] ]
_all_test_packages_ivi = [ _all_test_packages_ivi = [
......
...@@ -23,7 +23,7 @@ struct SetCircle { ...@@ -23,7 +23,7 @@ struct SetCircle {
@State FillColor: string = '#FF000000'; @State FillColor: string = '#FF000000';
@State X: number = 0; @State X: number = 0;
@State name: string = 'CanvasShadowOffsetX'; @State name: string = 'CanvasShadowOffsetX';
@State StepTips: string = '操作步骤:拖动滑块向右移动'+'\n'+'预期结果:阴影会随着拖动距离增大而向偏移,并显示偏移数值'; @State StepTips: string = '操作步骤:拖动滑块向右移动'+'\n'+'预期结果:阴影会随着拖动距离增大而向偏移,并显示偏移数值';
@State Vue: boolean = false; @State Vue: boolean = false;
async aboutToAppear(){ async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name); await FirstDialog.ChooseDialog(this.StepTips,this.name);
......
...@@ -48,10 +48,9 @@ struct CustomContainerUser { ...@@ -48,10 +48,9 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp') .fontColor(Color.White).fontSize('24fp')
} }
Row(){ Row(){
Text(`测试步骤:`+ '\n' + '\n' + `1.点击开始键进入系统桌面`+ '\n' + '\n' + `2.清空后台应用`+ '\n' + '\n' Text(`测试步骤:`+ '\n' + '\n' + `1.点击开始键进入系统桌面`+ '\n' + '\n' + `2.清空后台应用,将底层任务栏中应用拖至桌面`
+ `3.双击执行.bat选择冷启动测试输入待测应用编号`+ '\n' + '\n' +`4.测试应用冷启动返回validator界面` + '\n' + '\n' + `3.双击执行.bat选择冷启动>相机测试,回车执行`+ '\n' + '\n' +`4.测试应用自动执行冷启动后手动返回validator界面`
+ '\n' + '\n' + '5.点击停止键观察测试结果' + '\n' + '\n' + `6.若冷启动测试在规定时延内完成则通过测试` + '\n' + '\n' + '5.点击停止键观察测试结果' + '\n' + '\n' + `6.若冷启动测试在规定时延内完成则通过测试` + '\n' + '\n' )
+ '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp') .fontColor(Color.White).fontSize('20fp')
} }
Row(){ Row(){
...@@ -92,10 +91,10 @@ struct CustomContainerUser { ...@@ -92,10 +91,10 @@ struct CustomContainerUser {
let CameraBuf = new ArrayBuffer(4096); let CameraBuf = new ArrayBuffer(4096);
fileio.readSync(CameraFd,CameraBuf); fileio.readSync(CameraFd,CameraBuf);
let CameraReport = String.fromCharCode.apply(null,new Uint8Array(CameraBuf)); let CameraReport = String.fromCharCode.apply(null,new Uint8Array(CameraBuf));
let CameraHead = CameraReport.indexOf(':'); let CameraHead = CameraReport.indexOf('time:');
let CameraTime = CameraReport.substring(CameraHead+1); let CameraTime = CameraReport.substring(CameraHead+5);
this.cameraNum = parseFloat(CameraTime); this.cameraNum = parseFloat(CameraTime);
if( this.cameraNum < 2000 ) { if( 0 < this.cameraNum && this.cameraNum < 2000 ) {
this.num++ this.num++
} }
if( this.num === 1 ) { if( this.num === 1 ) {
......
...@@ -48,10 +48,9 @@ struct CustomContainerUser { ...@@ -48,10 +48,9 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp') .fontColor(Color.White).fontSize('24fp')
} }
Row(){ Row(){
Text(`测试步骤:`+ '\n' + '\n' + `1.点击开始键进入系统桌面`+ '\n' + '\n' + `2.清空后台应用`+ '\n' + '\n' Text(`测试步骤:`+ '\n' + '\n' + `1.点击开始键进入系统桌面`+ '\n' + '\n' + `2.清空后台应用,将底层任务栏中应用拖至桌面`
+ `3.双击执行.bat选择冷启动测试输入待测应用编号`+ '\n' + '\n' +`4.测试应用冷启动返回validator界面` + '\n' + '\n' + `3.双击执行.bat选择冷启动>联系人测试,回车执行`+ '\n' + '\n' +`4.测试应用自动执行冷启动后手动返回validator界面`
+ '\n' + '\n' + '5.点击停止键观察测试结果' + '\n' + '\n' + `6.若冷启动测试在规定时延内完成则通过测试` + '\n' + '\n' + '5.点击停止键观察测试结果' + '\n' + '\n' + `6.若冷启动测试在规定时延内完成则通过测试` + '\n' + '\n' )
+ '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp') .fontColor(Color.White).fontSize('20fp')
} }
Row(){ Row(){
...@@ -92,10 +91,10 @@ struct CustomContainerUser { ...@@ -92,10 +91,10 @@ struct CustomContainerUser {
let ContactsBuf = new ArrayBuffer(4096); let ContactsBuf = new ArrayBuffer(4096);
fileio.readSync(ContactsFd,ContactsBuf); fileio.readSync(ContactsFd,ContactsBuf);
let ContactsReport = String.fromCharCode.apply(null,new Uint8Array(ContactsBuf)); let ContactsReport = String.fromCharCode.apply(null,new Uint8Array(ContactsBuf));
let ContactsHead = ContactsReport.indexOf(':'); let ContactsHead = ContactsReport.indexOf('time:');
let ContactsTime = ContactsReport.substring(ContactsHead+1); let ContactsTime = ContactsReport.substring(ContactsHead+5);
this.contactsNum = parseFloat(ContactsTime); this.contactsNum = parseFloat(ContactsTime);
if( this.contactsNum < 2000 ) { if( 0 < this.contactsNum && this.contactsNum < 2000 ) {
this.num++ this.num++
} }
if( this.num === 1 ) { if( this.num === 1 ) {
......
...@@ -48,9 +48,9 @@ struct CustomContainerUser { ...@@ -48,9 +48,9 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp') .fontColor(Color.White).fontSize('24fp')
} }
Row(){ Row(){
Text(`测试步骤:`+ '\n' + '\n' + `1.点击开始键进入系统桌面`+ '\n' + '\n' + `2.开启应用回退到桌面,保证此时后台应用存在`+ '\n' + '\n' Text(`测试步骤:`+ '\n' + '\n' + `1.点击开始键进入系统桌面`+ '\n' + '\n' + `2.开启应用回退到桌面,保证此时后台应用存在`
+ `3.双击执行.bat选择热启动测试输入待测应用编号`+ '\n' + '\n' +`4.依次测试完所有应用热启动返回validator界面` + '\n' + '\n' + `3.双击执行.bat选择热启动>联系人测试`+ '\n' + '\n' +`4.测试应用手动执行热启动返回validator界面`
+ '\n' + '\n' + '5.点击停止键观察测试结果' + '\n' + '\n' + `5.若所有热启动测试均在规定时延内完成则通过测试` + '\n' + '\n' + '5.点击停止键观察测试结果' + '\n' + '\n' + `6.若所有热启动测试均在规定时延内完成则通过测试`
+ '\n' + '\n' + '\n' + '\n' ) + '\n' + '\n' + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp') .fontColor(Color.White).fontSize('20fp')
} }
...@@ -95,7 +95,7 @@ struct CustomContainerUser { ...@@ -95,7 +95,7 @@ struct CustomContainerUser {
let ContactsHead = ContactsReport.indexOf(':'); let ContactsHead = ContactsReport.indexOf(':');
let ContactsTime = ContactsReport.substring(ContactsHead+1); let ContactsTime = ContactsReport.substring(ContactsHead+1);
this.contactsNum = parseFloat(ContactsTime); this.contactsNum = parseFloat(ContactsTime);
if( this.contactsNum < 1000 ) { if( 0 < this.contactsNum && this.contactsNum < 1000 ) {
this.num++ this.num++
} }
if( this.num === 1 ) { if( this.num === 1 ) {
......
...@@ -88,7 +88,7 @@ struct CustomContainerUser { ...@@ -88,7 +88,7 @@ struct CustomContainerUser {
let head = report.indexOf(":"); let head = report.indexOf(":");
this.time = report.substring(head+1); this.time = report.substring(head+1);
let time = parseFloat(this.time) let time = parseFloat(this.time)
if( time < 1000 ) { if( 0 < time && time < 1000 ) {
this.Vue = true; this.Vue = true;
} }
}) })
......
...@@ -88,7 +88,7 @@ struct CustomContainerUser { ...@@ -88,7 +88,7 @@ struct CustomContainerUser {
let head = report.indexOf(":"); let head = report.indexOf(":");
this.time = report.substring(head+1); this.time = report.substring(head+1);
let time = parseFloat(this.time) let time = parseFloat(this.time)
if( time < 150 ) { if( 0 < time && time < 150 ) {
this.Vue = true; this.Vue = true;
} }
}) })
......
...@@ -48,10 +48,9 @@ struct CustomContainerUser { ...@@ -48,10 +48,9 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp') .fontColor(Color.White).fontSize('24fp')
} }
Row(){ Row(){
Text(`测试步骤:`+ '\n' + '\n' + `1.点击开始键进入系统桌面`+ '\n' + '\n' + `2.清空后台应用`+ '\n' + '\n' Text(`测试步骤:`+ '\n' + '\n' + `1.点击开始键进入系统桌面`+ '\n' + '\n' + `2.清空后台应用,将底层任务栏中应用拖至桌面`
+ `3.双击执行.bat选择冷启动测试输入待测应用编号`+ '\n' + '\n' +`4.依次测试完所有应用冷启动返回validator界面` + '\n' + '\n' + `3.双击执行.bat选择冷启动>信息测试,回车执行`+ '\n' + '\n' +`4.测试应用自动执行冷启动后手动返回validator界面`
+ '\n' + '\n' + '5.点击停止键观察测试结果' + '\n' + '\n' + `6.若所有冷启动测试均在规定时延内完成则通过测试` + '\n' + '\n' + '5.点击停止键观察测试结果' + '\n' + '\n' + `6.若冷启动测试在规定时延内完成则通过测试` + '\n' + '\n' )
+ '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp') .fontColor(Color.White).fontSize('20fp')
} }
Row(){ Row(){
...@@ -92,10 +91,10 @@ struct CustomContainerUser { ...@@ -92,10 +91,10 @@ struct CustomContainerUser {
let MmsBuf = new ArrayBuffer(4096); let MmsBuf = new ArrayBuffer(4096);
fileio.readSync(MmsFd,MmsBuf); fileio.readSync(MmsFd,MmsBuf);
let MmsReport = String.fromCharCode.apply(null,new Uint8Array(MmsBuf)); let MmsReport = String.fromCharCode.apply(null,new Uint8Array(MmsBuf));
let MmsHead = MmsReport.indexOf(':'); let MmsHead = MmsReport.indexOf('time:');
let MmsTime = MmsReport.substring(MmsHead+1); let MmsTime = MmsReport.substring(MmsHead+5);
this.mmsNum = parseFloat(MmsTime); this.mmsNum = parseFloat(MmsTime);
if( this.mmsNum < 2000 ) { if( 0 < this.mmsNum && this.mmsNum < 2000 ) {
this.num++ this.num++
} }
if( this.num === 1 ) { if( this.num === 1 ) {
...@@ -105,7 +104,7 @@ struct CustomContainerUser { ...@@ -105,7 +104,7 @@ struct CustomContainerUser {
} }
} }
Row(){ Row(){
Text('\n' + '\n' + `测试结果:` + '\n' + '\n' + '信息冷启动时延' + this.mmsNum + 'ms' + '\n' + '通过冷启动测试项' + this.num + '个') Text('\n' + '\n' + `测试结果:` + '\n' + '\n' + '信息冷启动时延' + this.mmsNum + 'ms')
.fontColor(Color.White).fontSize('24fp') .fontColor(Color.White).fontSize('24fp')
} }
} }
......
...@@ -48,9 +48,9 @@ struct CustomContainerUser { ...@@ -48,9 +48,9 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp') .fontColor(Color.White).fontSize('24fp')
} }
Row(){ Row(){
Text(`测试步骤:`+ '\n' + '\n' + `1.点击开始键进入系统桌面`+ '\n' + '\n' + `2.开启应用回退到桌面,保证此时后台应用存在`+ '\n' + '\n' Text(`测试步骤:`+ '\n' + '\n' + `1.点击开始键进入系统桌面`+ '\n' + '\n' + `2.开启应用回退到桌面,保证此时后台应用存在`
+ `3.双击执行.bat选择热启动测试输入待测应用编号`+ '\n' + '\n' +`4.依次测试完所有应用热启动返回validator界面` + '\n' + '\n' + `3.双击执行.bat选择热启动>信息测试`+ '\n' + '\n' +`4.测试应用手动执行热启动后返回validator界面`
+ '\n' + '\n' + '5.点击停止键观察测试结果' + '\n' + '\n' + `5.若所有热启动测试均在规定时延内完成则通过测试` + '\n' + '\n' + '5.点击停止键观察测试结果' + '\n' + '\n' + `5.若热启动测试在规定时延内完成则通过测试`
+ '\n' + '\n' + '\n' + '\n' ) + '\n' + '\n' + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp') .fontColor(Color.White).fontSize('20fp')
} }
...@@ -95,7 +95,7 @@ struct CustomContainerUser { ...@@ -95,7 +95,7 @@ struct CustomContainerUser {
let MmsHead = MmsReport.indexOf(':'); let MmsHead = MmsReport.indexOf(':');
let MmsTime = MmsReport.substring(MmsHead+1); let MmsTime = MmsReport.substring(MmsHead+1);
this.mmsNum = parseFloat(MmsTime); this.mmsNum = parseFloat(MmsTime);
if( this.mmsNum < 1000 ) { if( 0 < this.mmsNum && this.mmsNum < 1000 ) {
this.num++ this.num++
} }
if( this.num === 1 ) { if( this.num === 1 ) {
...@@ -105,8 +105,7 @@ struct CustomContainerUser { ...@@ -105,8 +105,7 @@ struct CustomContainerUser {
} }
} }
Row(){ Row(){
Text('\n' + '\n' + '\n' + '\n' + `测试结果:` + '\n' + '\n'+ '信息热启动时延' + this.mmsNum + 'ms' Text('\n' + '\n' + '\n' + '\n' + `测试结果:` + '\n' + '\n'+ '信息热启动时延' + this.mmsNum + 'ms')
+ '\n' + '通过热启动测试项' + this.num + '个' )
.fontColor(Color.White).fontSize('24fp') .fontColor(Color.White).fontSize('24fp')
} }
} }
......
...@@ -48,10 +48,9 @@ struct CustomContainerUser { ...@@ -48,10 +48,9 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp') .fontColor(Color.White).fontSize('24fp')
} }
Row(){ Row(){
Text(`测试步骤:`+ '\n' + '\n' + `1.点击开始键进入系统桌面`+ '\n' + '\n' + `2.清空后台应用`+ '\n' + '\n' Text(`测试步骤:`+ '\n' + '\n' + `1.点击开始键进入系统桌面`+ '\n' + '\n' + `2.清空后台应用,将底层任务栏中应用拖至桌面`
+ `3.双击执行.bat选择冷启动测试输入待测应用编号`+ '\n' + '\n' +`4.依次测试完所有应用冷启动返回validator界面` + '\n' + '\n' + `3.双击执行.bat选择冷启动>图库测试,回车执行`+ '\n' + '\n' +`4.测试应用自动执行冷启动后手动返回validator界面`
+ '\n' + '\n' + '5.点击停止键观察测试结果' + '\n' + '\n' + `6.若所有冷启动测试均在规定时延内完成则通过测试` + '\n' + '\n' + '5.点击停止键观察测试结果' + '\n' + '\n' + `6.若冷启动测试在规定时延内完成则通过测试` + '\n' + '\n' )
+ '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp') .fontColor(Color.White).fontSize('20fp')
} }
Row(){ Row(){
...@@ -92,10 +91,10 @@ struct CustomContainerUser { ...@@ -92,10 +91,10 @@ struct CustomContainerUser {
let photosBuf = new ArrayBuffer(4096); let photosBuf = new ArrayBuffer(4096);
fileio.readSync(photosFd,photosBuf); fileio.readSync(photosFd,photosBuf);
let photosReport = String.fromCharCode.apply(null,new Uint8Array(photosBuf)); let photosReport = String.fromCharCode.apply(null,new Uint8Array(photosBuf));
let photosHead = photosReport.indexOf(':'); let photosHead = photosReport.indexOf('time:');
let photosTime = photosReport.substring(photosHead+1); let photosTime = photosReport.substring(photosHead+5);
this.photosNum = parseFloat(photosTime); this.photosNum = parseFloat(photosTime);
if( this.photosNum < 2000 ) { if( 0 < this.photosNum && this.photosNum < 2000 ) {
this.num++ this.num++
} }
if( this.num === 1 ) { if( this.num === 1 ) {
...@@ -105,8 +104,7 @@ struct CustomContainerUser { ...@@ -105,8 +104,7 @@ struct CustomContainerUser {
} }
} }
Row(){ Row(){
Text('\n' + '\n' + `测试结果:` + '\n' + '\n' + '图库冷启动时延' + this.photosNum + 'ms' Text('\n' + '\n' + `测试结果:` + '\n' + '\n' + '图库冷启动时延' + this.photosNum + 'ms')
+ '\n' + '通过冷启动测试项' + this.num + '个')
.fontColor(Color.White).fontSize('24fp') .fontColor(Color.White).fontSize('24fp')
} }
} }
......
...@@ -48,9 +48,9 @@ struct CustomContainerUser { ...@@ -48,9 +48,9 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp') .fontColor(Color.White).fontSize('24fp')
} }
Row(){ Row(){
Text(`测试步骤:`+ '\n' + '\n' + `1.点击开始键进入系统桌面`+ '\n' + '\n' + `2.开启应用回退到桌面,保证此时后台应用存在`+ '\n' + '\n' Text(`测试步骤:`+ '\n' + '\n' + `1.点击开始键进入系统桌面`+ '\n' + '\n' + `2.开启应用回退到桌面,保证此时后台应用存在`
+ `3.双击执行.bat选择热启动测试输入待测应用编号`+ '\n' + '\n' +`4.依次测试完所有应用热启动返回validator界面` + '\n' + '\n' + `3.双击执行.bat选择热启动>图库测试`+ '\n' + '\n' +`4.测试应用手动执行热启动后返回validator界面`
+ '\n' + '\n' + '5.点击停止键观察测试结果' + '\n' + '\n' + `5.若所有热启动测试均在规定时延内完成则通过测试` + '\n' + '\n' + '5.点击停止键观察测试结果' + '\n' + '\n' + `5.若热启动测试在规定时延内完成则通过测试`
+ '\n' + '\n' + '\n' + '\n' ) + '\n' + '\n' + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp') .fontColor(Color.White).fontSize('20fp')
} }
...@@ -95,7 +95,7 @@ struct CustomContainerUser { ...@@ -95,7 +95,7 @@ struct CustomContainerUser {
let photosHead = photosReport.indexOf(':'); let photosHead = photosReport.indexOf(':');
let photosTime = photosReport.substring(photosHead+1); let photosTime = photosReport.substring(photosHead+1);
this.photosNum = parseFloat(photosTime); this.photosNum = parseFloat(photosTime);
if( this.photosNum < 1000 ) { if( 0 < this.photosNum && this.photosNum < 1000 ) {
this.num++ this.num++
} }
if( this.num === 1 ) { if( this.num === 1 ) {
...@@ -105,8 +105,7 @@ struct CustomContainerUser { ...@@ -105,8 +105,7 @@ struct CustomContainerUser {
} }
} }
Row(){ Row(){
Text('\n' + '\n' + '\n' + '\n' + `测试结果:` + '\n' + '\n' + '图库热启动时延' + this.photosNum + 'ms' Text('\n' + '\n' + '\n' + '\n' + `测试结果:` + '\n' + '\n' + '图库热启动时延' + this.photosNum + 'ms')
+ '\n' + '通过热启动测试项' + this.num + '个' )
.fontColor(Color.White).fontSize('24fp') .fontColor(Color.White).fontSize('24fp')
} }
} }
......
...@@ -88,7 +88,7 @@ struct CustomContainerUser { ...@@ -88,7 +88,7 @@ struct CustomContainerUser {
let head = report.indexOf(":"); let head = report.indexOf(":");
this.time = report.substring(head+1); this.time = report.substring(head+1);
let time = parseFloat(this.time) let time = parseFloat(this.time)
if( time < 150 ) { if( 0 < time && time < 150 ) {
this.Vue = true; this.Vue = true;
} }
}) })
......
...@@ -48,10 +48,9 @@ struct CustomContainerUser { ...@@ -48,10 +48,9 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp') .fontColor(Color.White).fontSize('24fp')
} }
Row(){ Row(){
Text(`测试步骤:`+ '\n' + '\n' + `1.点击开始键进入系统桌面`+ '\n' + '\n' + `2.清空后台应用`+ '\n' + '\n' Text(`测试步骤:`+ '\n' + '\n' + `1.点击开始键进入系统桌面`+ '\n' + '\n' + `2.清空后台应用,将底层任务栏中应用拖至桌面`
+ `3.双击执行.bat选择冷启动测试输入待测应用编号`+ '\n' + '\n' +`4.依次测试完所有应用冷启动返回validator界面` + '\n' + '\n' + `3.双击执行.bat选择冷启动>设置测试,回车执行`+ '\n' + '\n' +`4.测试应用自动执行冷启动后手动返回validator界面`
+ '\n' + '\n' + '5.点击停止键观察测试结果' + '\n' + '\n' + `6.若所有冷启动测试均在规定时延内完成则通过测试` + '\n' + '\n' + '5.点击停止键观察测试结果' + '\n' + '\n' + `6.若冷启动测试在规定时延内完成则通过测试` + '\n' + '\n' )
+ '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp') .fontColor(Color.White).fontSize('20fp')
} }
Row(){ Row(){
...@@ -92,10 +91,10 @@ struct CustomContainerUser { ...@@ -92,10 +91,10 @@ struct CustomContainerUser {
let setBuf = new ArrayBuffer(4096); let setBuf = new ArrayBuffer(4096);
fileio.readSync(setFd,setBuf); fileio.readSync(setFd,setBuf);
let setReport = String.fromCharCode.apply(null,new Uint8Array(setBuf)); let setReport = String.fromCharCode.apply(null,new Uint8Array(setBuf));
let setHead = setReport.indexOf(':'); let setHead = setReport.indexOf('time:');
let setTime = setReport.substring(setHead+1); let setTime = setReport.substring(setHead+5);
this.setNum = parseFloat(setTime); this.setNum = parseFloat(setTime);
if( this.setNum < 2000 ) { if( 0 < this.setNum && this.setNum < 2000 ) {
this.num++ this.num++
} }
if( this.num === 1 ) { if( this.num === 1 ) {
...@@ -105,8 +104,7 @@ struct CustomContainerUser { ...@@ -105,8 +104,7 @@ struct CustomContainerUser {
} }
} }
Row(){ Row(){
Text('\n' + '\n' + `测试结果:` + '\n' + '\n' + '设置冷启动时延' + this.setNum + 'ms' Text('\n' + '\n' + `测试结果:` + '\n' + '\n' + '设置冷启动时延' + this.setNum + 'ms')
+ '\n' + '通过冷启动测试项' + this.num + '个')
.fontColor(Color.White).fontSize('24fp') .fontColor(Color.White).fontSize('24fp')
} }
} }
......
...@@ -48,9 +48,9 @@ struct CustomContainerUser { ...@@ -48,9 +48,9 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp') .fontColor(Color.White).fontSize('24fp')
} }
Row(){ Row(){
Text(`测试步骤:`+ '\n' + '\n' + `1.点击开始键进入系统桌面`+ '\n' + '\n' + `2.开启应用回退到桌面,保证此时后台应用存在`+ '\n' + '\n' Text(`测试步骤:`+ '\n' + '\n' + `1.点击开始键进入系统桌面`+ '\n' + '\n' + `2.开启应用回退到桌面,保证此时后台应用存在`
+ `3.双击执行.bat选择热启动测试输入待测应用编号`+ '\n' + '\n' +`4.依次测试完所有应用热启动返回validator界面` + '\n' + '\n' + `3.双击执行.bat选择热启动>设置测试`+ '\n' + '\n' +`4.测试应用手动执行热启动后返回validator界面`
+ '\n' + '\n' + '5.点击停止键观察测试结果' + '\n' + '\n' + `5.若所有热启动测试均在规定时延内完成则通过测试` + '\n' + '\n' + '5.点击停止键观察测试结果' + '\n' + '\n' + `5.若热启动测试在规定时延内完成则通过测试`
+ '\n' + '\n' + '\n' + '\n' ) + '\n' + '\n' + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp') .fontColor(Color.White).fontSize('20fp')
} }
...@@ -95,7 +95,7 @@ struct CustomContainerUser { ...@@ -95,7 +95,7 @@ struct CustomContainerUser {
let setHead = setReport.indexOf(':'); let setHead = setReport.indexOf(':');
let setTime = setReport.substring(setHead+1); let setTime = setReport.substring(setHead+1);
this.setNum = parseFloat(setTime); this.setNum = parseFloat(setTime);
if( this.setNum < 1000 ) { if( 0 < this.setNum && this.setNum < 1000 ) {
this.num++ this.num++
} }
if( this.num === 1 ) { if( this.num === 1 ) {
...@@ -105,8 +105,7 @@ struct CustomContainerUser { ...@@ -105,8 +105,7 @@ struct CustomContainerUser {
} }
} }
Row(){ Row(){
Text('\n' + '\n' + '\n' + '\n' + `测试结果:` + '\n' + '\n' + '设置热启动时延' + this.setNum + 'ms' Text('\n' + '\n' + '\n' + '\n' + `测试结果:` + '\n' + '\n' + '设置热启动时延' + this.setNum + 'ms')
+ '\n' + '通过热启动测试项' + this.num + '个' )
.fontColor(Color.White).fontSize('24fp') .fontColor(Color.White).fontSize('24fp')
} }
} }
......
...@@ -86,7 +86,7 @@ struct CustomContainerUser { ...@@ -86,7 +86,7 @@ struct CustomContainerUser {
let head = report.indexOf(":"); let head = report.indexOf(":");
this.time = report.substring(head+1); this.time = report.substring(head+1);
let time = parseFloat(this.time) let time = parseFloat(this.time)
if( time < 600 ) { if( 0 < time && time < 600 ) {
this.Vue = true; this.Vue = true;
} }
}) })
......
...@@ -86,7 +86,7 @@ struct CustomContainerUser { ...@@ -86,7 +86,7 @@ struct CustomContainerUser {
let head = report.indexOf(":"); let head = report.indexOf(":");
this.time = report.substring(head+1); this.time = report.substring(head+1);
let time = parseFloat(this.time) let time = parseFloat(this.time)
if( time < 150 ) { if( 0 < time && time < 150 ) {
this.Vue = true; this.Vue = true;
} }
}) })
......
...@@ -86,7 +86,7 @@ struct CustomContainerUser { ...@@ -86,7 +86,7 @@ struct CustomContainerUser {
let head = report.indexOf(":"); let head = report.indexOf(":");
this.time = report.substring(head+1); this.time = report.substring(head+1);
let time = parseFloat(this.time) let time = parseFloat(this.time)
if( time < 1000 ) { if( 0 < time && time < 1000 ) {
this.Vue = true; this.Vue = true;
} }
}) })
......
...@@ -88,7 +88,7 @@ struct CustomContainerUser { ...@@ -88,7 +88,7 @@ struct CustomContainerUser {
let head = report.indexOf(":"); let head = report.indexOf(":");
this.time = report.substring(head+1); this.time = report.substring(head+1);
let time = parseFloat(this.time) let time = parseFloat(this.time)
if( time < 150 ) { if( 0 < time && time < 150 ) {
this.Vue = true; this.Vue = true;
} }
}) })
......
...@@ -429,7 +429,7 @@ struct IndexPage { ...@@ -429,7 +429,7 @@ struct IndexPage {
let serializer = new xml.XmlSerializer(bufView); let serializer = new xml.XmlSerializer(bufView);
serializer.setDeclaration(); serializer.setDeclaration();
serializer.startElement("testsuites"); serializer.startElement("testsuites");
serializer.setAttributes("name", "ActValidator"); serializer.setAttributes("name", "ActsValidator");
serializer.setAttributes("starttime", starttime); serializer.setAttributes("starttime", starttime);
serializer.setAttributes("endtime", endtime); serializer.setAttributes("endtime", endtime);
serializer.setAttributes("errors", "0"); serializer.setAttributes("errors", "0");
...@@ -439,8 +439,8 @@ struct IndexPage { ...@@ -439,8 +439,8 @@ struct IndexPage {
serializer.setAttributes("ignored", "0"); serializer.setAttributes("ignored", "0");
serializer.setAttributes("unavailable", "0"); serializer.setAttributes("unavailable", "0");
serializer.setAttributes("productinfo", "{ }"); serializer.setAttributes("productinfo", "{ }");
serializer.setAttributes("modules", "*"); serializer.setAttributes("modules", "ActsValidator");
serializer.setAttributes("runmodules", "*"); serializer.setAttributes("runmodules", "ActsValidator");
/* /*
* ArkUI * ArkUI
*/ */
...@@ -453,7 +453,7 @@ struct IndexPage { ...@@ -453,7 +453,7 @@ struct IndexPage {
serializer.setAttributes("ignored", "0"); serializer.setAttributes("ignored", "0");
serializer.setAttributes("tests", ArkuiTestNum); serializer.setAttributes("tests", ArkuiTestNum);
serializer.setAttributes("message", "*"); serializer.setAttributes("message", "*");
serializer.setAttributes("modulename", "ActsArkUITest"); serializer.setAttributes("modulename", "ActsValidator");
for (let i = 0; i < title1.length; i++) { for (let i = 0; i < title1.length; i++) {
serializer.startElement("testcase"); serializer.startElement("testcase");
serializer.setAttributes("name", String(title1[i])); serializer.setAttributes("name", String(title1[i]));
...@@ -478,7 +478,7 @@ struct IndexPage { ...@@ -478,7 +478,7 @@ struct IndexPage {
serializer.setAttributes("ignored", "0"); serializer.setAttributes("ignored", "0");
serializer.setAttributes("tests", audioTestNum); serializer.setAttributes("tests", audioTestNum);
serializer.setAttributes("message", "*"); serializer.setAttributes("message", "*");
serializer.setAttributes("modulename", "ActsAudioTest"); serializer.setAttributes("modulename", "ActsValidator");
for (let i = 0; i < title2.length; i++) { for (let i = 0; i < title2.length; i++) {
serializer.startElement("testcase"); serializer.startElement("testcase");
serializer.setAttributes("name", String(title2[i])); serializer.setAttributes("name", String(title2[i]));
...@@ -503,7 +503,7 @@ struct IndexPage { ...@@ -503,7 +503,7 @@ struct IndexPage {
serializer.setAttributes("ignored", "0"); serializer.setAttributes("ignored", "0");
serializer.setAttributes("tests", cameraTestNum); serializer.setAttributes("tests", cameraTestNum);
serializer.setAttributes("message", "*"); serializer.setAttributes("message", "*");
serializer.setAttributes("modulename", "ActsCameraTest"); serializer.setAttributes("modulename", "ActsValidator");
for (let i = 0; i < title3.length; i++) { for (let i = 0; i < title3.length; i++) {
serializer.startElement("testcase"); serializer.startElement("testcase");
serializer.setAttributes("name", String(title3[i])); serializer.setAttributes("name", String(title3[i]));
...@@ -528,7 +528,7 @@ struct IndexPage { ...@@ -528,7 +528,7 @@ struct IndexPage {
serializer.setAttributes("ignored", "0"); serializer.setAttributes("ignored", "0");
serializer.setAttributes("tests", playerTestNum); serializer.setAttributes("tests", playerTestNum);
serializer.setAttributes("message", "*"); serializer.setAttributes("message", "*");
serializer.setAttributes("modulename", "ActsPlayerTest"); serializer.setAttributes("modulename", "ActsValidator");
for (let i = 0; i < title4.length; i++) { for (let i = 0; i < title4.length; i++) {
serializer.startElement("testcase"); serializer.startElement("testcase");
serializer.setAttributes("name", String(title4[i])); serializer.setAttributes("name", String(title4[i]));
...@@ -553,7 +553,7 @@ struct IndexPage { ...@@ -553,7 +553,7 @@ struct IndexPage {
serializer.setAttributes("ignored", "0"); serializer.setAttributes("ignored", "0");
serializer.setAttributes("tests", experienceTestNum); serializer.setAttributes("tests", experienceTestNum);
serializer.setAttributes("message", "*"); serializer.setAttributes("message", "*");
serializer.setAttributes("modulename", "ActsExperienceTest"); serializer.setAttributes("modulename", "ActsValidator");
for (let i = 0; i < title5.length; i++) { for (let i = 0; i < title5.length; i++) {
serializer.startElement("testcase"); serializer.startElement("testcase");
serializer.setAttributes("name", String(title5[i])); serializer.setAttributes("name", String(title5[i]));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册