Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
28ba34e4
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
大约 1 年 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
28ba34e4
编写于
5月 27, 2023
作者:
O
openharmony_ci
提交者:
Gitee
5月 27, 2023
浏览文件
操作
浏览文件
下载
差异文件
!8787 卡片systemApi蓝区测试用例移除
Merge pull request !8787 from chenyuyan/test
上级
3413a1fd
6a600a44
变更
42
隐藏空白更改
内联
并排
Showing
42 changed file
with
2 addition
and
4466 deletion
+2
-4466
ability/ability_runtime/formmanager/fa/BUILD.gn
ability/ability_runtime/formmanager/fa/BUILD.gn
+0
-3
ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostg/entry/src/main/ets/MainAbility/pages/index.ets
...ystemhostg/entry/src/main/ets/MainAbility/pages/index.ets
+2
-2
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/BUILD.gn
...formsystemtest_ets/formstatetest_notifyinvisible/BUILD.gn
+0
-38
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/Test.json
...ormsystemtest_ets/formstatetest_notifyinvisible/Test.json
+0
-25
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/config.json
.../formstatetest_notifyinvisible/entry/src/main/config.json
+0
-167
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/MainAbility/app.ets
...st_notifyinvisible/entry/src/main/ets/MainAbility/app.ets
+0
-23
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/MainAbility/pages/index.ets
...yinvisible/entry/src/main/ets/MainAbility/pages/index.ets
+0
-34
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/TestAbility/app.ets
...st_notifyinvisible/entry/src/main/ets/TestAbility/app.ets
+0
-32
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/TestAbility/pages/index.ets
...yinvisible/entry/src/main/ets/TestAbility/pages/index.ets
+0
-49
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
...le/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
+0
-77
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/test/FmsFormStateNotifyInvisible.test.ets
...ry/src/main/ets/test/FmsFormStateNotifyInvisible.test.ets
+0
-573
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/test/List.test.ets
...est_notifyinvisible/entry/src/main/ets/test/List.test.ets
+0
-19
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/resources/base/element/string.json
...visible/entry/src/main/resources/base/element/string.json
+0
-20
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/resources/base/media/icon.png
...ifyinvisible/entry/src/main/resources/base/media/icon.png
+0
-0
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/signature/openharmony_sx.p7b
...ormstatetest_notifyinvisible/signature/openharmony_sx.p7b
+0
-0
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/BUILD.gn
...ormsystemtest_ets/formstatetest_notifyinvisible2/BUILD.gn
+0
-38
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/Test.json
...rmsystemtest_ets/formstatetest_notifyinvisible2/Test.json
+0
-26
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/config.json
...formstatetest_notifyinvisible2/entry/src/main/config.json
+0
-167
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/MainAbility/app.ets
...t_notifyinvisible2/entry/src/main/ets/MainAbility/app.ets
+0
-23
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/MainAbility/pages/index.ets
...invisible2/entry/src/main/ets/MainAbility/pages/index.ets
+0
-34
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/TestAbility/app.ets
...t_notifyinvisible2/entry/src/main/ets/TestAbility/app.ets
+0
-32
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/TestAbility/pages/index.ets
...invisible2/entry/src/main/ets/TestAbility/pages/index.ets
+0
-49
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
...e2/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
+0
-77
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/test/FmsFormStateNotifyInvisible2.test.ets
...y/src/main/ets/test/FmsFormStateNotifyInvisible2.test.ets
+0
-869
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/test/List.test.ets
...st_notifyinvisible2/entry/src/main/ets/test/List.test.ets
+0
-19
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/resources/base/element/string.json
...isible2/entry/src/main/resources/base/element/string.json
+0
-20
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/resources/base/media/icon.png
...fyinvisible2/entry/src/main/resources/base/media/icon.png
+0
-0
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/signature/openharmony_sx.p7b
...rmstatetest_notifyinvisible2/signature/openharmony_sx.p7b
+0
-0
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/BUILD.gn
...a/formsystemtest_ets/formstatetest_notifyvisible/BUILD.gn
+0
-38
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/Test.json
.../formsystemtest_ets/formstatetest_notifyvisible/Test.json
+0
-31
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/config.json
...ts/formstatetest_notifyvisible/entry/src/main/config.json
+0
-167
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/MainAbility/app.ets
...test_notifyvisible/entry/src/main/ets/MainAbility/app.ets
+0
-23
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/MainAbility/pages/index.ets
...ifyvisible/entry/src/main/ets/MainAbility/pages/index.ets
+0
-34
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/TestAbility/app.ets
...test_notifyvisible/entry/src/main/ets/TestAbility/app.ets
+0
-32
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/TestAbility/pages/index.ets
...ifyvisible/entry/src/main/ets/TestAbility/pages/index.ets
+0
-49
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
...le/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
+0
-77
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/test/FmsFormStateNotifyVisible.test.ets
...ntry/src/main/ets/test/FmsFormStateNotifyVisible.test.ets
+0
-1404
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/test/List.test.ets
...etest_notifyvisible/entry/src/main/ets/test/List.test.ets
+0
-19
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/resources/base/element/string.json
...visible/entry/src/main/resources/base/element/string.json
+0
-20
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/resources/base/media/icon.png
...otifyvisible/entry/src/main/resources/base/media/icon.png
+0
-0
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/signature/openharmony_sx.p7b
.../formstatetest_notifyvisible/signature/openharmony_sx.p7b
+0
-0
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/ets/test/FmsStress.test.ets
...formstresstest/entry/src/main/ets/test/FmsStress.test.ets
+0
-156
未找到文件。
ability/ability_runtime/formmanager/fa/BUILD.gn
浏览文件 @
28ba34e4
...
...
@@ -59,9 +59,6 @@ group("formmanager") {
"formsystemtest_ets/formreleasetest:ActsFormReleaseTest",
"formsystemtest_ets/formstatetest_disable:ActsFormStateDisableTest",
"formsystemtest_ets/formstatetest_enable:ActsFormStateEnableTest",
"formsystemtest_ets/formstatetest_notifyinvisible:ActsFormStateNotifyInvisibleTest",
"formsystemtest_ets/formstatetest_notifyinvisible2:ActsFormStateNotifyInvisible2Test",
"formsystemtest_ets/formstatetest_notifyvisible:ActsFormStateNotifyVisibleTest",
"formsystemtest_ets/formstresstest:ActsFormStressTest",
"formsystemtest_ets/formupdatefreshtest:ActsFormUpdateRefreshTest",
]
...
...
ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostg/entry/src/main/ets/MainAbility/pages/index.ets
浏览文件 @
28ba34e4
...
...
@@ -357,13 +357,13 @@ struct Index {
}
};
commonEvent.publish(this.formOnStateEvent, commonEventPublishData, this.publishOnStateCallBack);
});
});
console.log("[FormComponent.host] notifyVisibleForm end");
} else if(this.stateForm == "invisible") {
console.log("[FormComponent.host] notifyInvisibleForm start");
formHost.notifyInvisibleForms(this.stateIds)
.then((data) => {
console.info('[FormComponent.host] notifyInvisibleForm result:' + data);
console.info('[FormComponent.host] notifyInvisibleForm result:' + data);
if(this.stateIds.length == 0) {
this.stateIds = ["-1"];
}
...
...
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/BUILD.gn
已删除
100644 → 0
浏览文件 @
3413a1fd
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsFormStateNotifyInvisibleTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_js_test_assets",
":hjs_demo_resources",
]
ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsFormStateNotifyInvisibleTest"
subsystem_name = "ability"
part_name = "form_fwk"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/ets/MainAbility"
}
ohos_js_assets("hjs_demo_js_test_assets") {
source_dir = "./entry/src/main/ets/TestAbility"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json"
}
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/Test.json
已删除
100644 → 0
浏览文件 @
3413a1fd
{
"description"
:
"Configuration for hjunit demo Tests"
,
"driver"
:
{
"type"
:
"OHJSUnitTest"
,
"test-timeout"
:
"300000"
,
"bundle-name"
:
"com.ohos.st.formstatenotifyinvisibletest"
,
"package-name"
:
"com.ohos.st.formstatenotifyinvisibletest"
,
"shell-timeout"
:
"600000"
,
"testcase-timeout"
:
"30000"
},
"kits"
:
[
{
"test-file-name"
:
[
"ActsFormStateNotifyInvisibleTest.hap"
,
"FormSystemHostF.hap"
,
"FormSystemHostG.hap"
,
"FormSystemHostNoPerm.hap"
,
"FormSupplyAppA.hap"
,
"FormSupplyAppF.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
}
]
}
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/config.json
已删除
100644 → 0
浏览文件 @
3413a1fd
{
"app"
:
{
"bundleName"
:
"com.ohos.st.formstatenotifyinvisibletest"
,
"vendor"
:
"ohos"
,
"version"
:
{
"code"
:
1000000
,
"name"
:
"1.0.0"
},
"apiVersion"
:
{
"compatible"
:
7
,
"releaseType"
:
"Release"
,
"target"
:
7
}
},
"deviceConfig"
:
{},
"module"
:
{
"package"
:
"com.ohos.st.formstatenotifyinvisibletest"
,
"name"
:
".FormStateSTApp"
,
"mainAbility"
:
".MainAbility"
,
"deviceType"
:
[
"default"
,
"tablet"
],
"distro"
:
{
"deliveryWithInstall"
:
true
,
"moduleName"
:
"entry"
,
"moduleType"
:
"entry"
,
"installationFree"
:
false
},
"abilities"
:
[
{
"skills"
:
[
{
"entities"
:
[
"entity.system.home"
],
"actions"
:
[
"action.system.home"
]
}
],
"visible"
:
true
,
"name"
:
".MainAbility"
,
"srcPath"
:
"MainAbility"
,
"srcLanguage"
:
"ets"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:description_mainability"
,
"label"
:
"$string:entry_MainAbility"
,
"type"
:
"page"
,
"launchType"
:
"standard"
},
{
"orientation"
:
"unspecified"
,
"formsEnabled"
:
false
,
"name"
:
".TestAbility"
,
"srcLanguage"
:
"ets"
,
"srcPath"
:
"TestAbility"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:TestAbility_desc"
,
"label"
:
"$string:TestAbility_label"
,
"type"
:
"page"
,
"visible"
:
true
,
"launchType"
:
"singleton"
}
],
"defPermissions"
:
[
{
"availableScope"
:
[],
"grantMode"
:
"system_grant"
,
"name"
:
"FMS_FormDelete_commonEvent"
},
{
"availableScope"
:
[],
"grantMode"
:
"system_grant"
,
"name"
:
"FMS_FormOnAcquired_commonEvent"
},
{
"availableScope"
:
[],
"grantMode"
:
"system_grant"
,
"name"
:
"FMS_FormOnError_commonEvent"
},
{
"availableScope"
:
[],
"grantMode"
:
"system_grant"
,
"name"
:
"FMS_FormOnDeleted_commonEvent"
},
{
"availableScope"
:
[],
"grantMode"
:
"system_grant"
,
"name"
:
"FMS_FormOnState_commonEvent"
},
{
"availableScope"
:
[],
"grantMode"
:
"system_grant"
,
"name"
:
"FMS_FormSupply_commonEvent"
}
],
"reqPermissions"
:
[
{
"name"
:
"FMS_FormOnAcquired_commonEvent"
,
"reason"
:
"need use onAcquired commonEvent"
},
{
"name"
:
"FMS_FormDelete_commonEvent"
,
"reason"
:
"need use delete commonEvent"
},
{
"name"
:
"FMS_FormOnError_commonEvent"
,
"reason"
:
"need use OnError commonEvent"
},
{
"name"
:
"FMS_FormOnDeleted_commonEvent"
,
"reason"
:
"need use OnDeleted commonEvent"
},
{
"name"
:
"FMS_FormOnState_commonEvent"
,
"reason"
:
"need use OnState commonEvent"
},
{
"name"
:
"FMS_FormSupply_commonEvent"
,
"reason"
:
"need use FormSupply commonEvent"
},
{
"name"
:
"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
,
"reason"
:
"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
},
{
"name"
:
"ohos.permission.CLEAN_BACKGROUND_PROCESSES"
,
"reason"
:
"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES"
},
{
"name"
:
"ohos.permission.START_ABILITIES_FROM_BACKGROUND"
,
"reason"
:
"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND"
}
],
"js"
:
[
{
"mode"
:
{
"syntax"
:
"ets"
,
"type"
:
"pageAbility"
},
"pages"
:
[
"pages/index"
],
"name"
:
".MainAbility"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
},
{
"mode"
:
{
"syntax"
:
"ets"
,
"type"
:
"pageAbility"
},
"pages"
:
[
"pages/index"
],
"name"
:
".TestAbility"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
}
]
}
}
\ No newline at end of file
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/MainAbility/app.ets
已删除
100644 → 0
浏览文件 @
3413a1fd
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('[FormComponent] Application onCreate')
},
onDestroy() {
console.info('[FormComponent] Application onDestroy')
},
}
\ No newline at end of file
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/MainAbility/pages/index.ets
已删除
100644 → 0
浏览文件 @
3413a1fd
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
build() {
Flex({
direction: FlexDirection.Column,
alignItems: ItemAlign.Center,
justifyContent: FlexAlign.Center
}) {
Text('Fms Main Ability Test')
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
.height('100%')
}
}
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/TestAbility/app.ets
已删除
100644 → 0
浏览文件 @
3413a1fd
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
export default {
onCreate() {
console.info('Application onCreate')
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
},
onDestroy() {
console.info('Application onDestroy')
},
}
\ No newline at end of file
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/TestAbility/pages/index.ets
已删除
100644 → 0
浏览文件 @
3413a1fd
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import router from '@system.router';
@Entry
@Component
struct Index {
aboutToAppear() {
console.info('TestAbility index aboutToAppear')
}
@State message: string = 'Hello World'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('next page')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.width('35%')
.height('5%')
.onClick(()=>{
})
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
已删除
100644 → 0
浏览文件 @
3413a1fd
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
TestRunner
from
'
@ohos.application.testRunner
'
import
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
var
abilityDelegator
=
undefined
var
abilityDelegatorArguments
=
undefined
function
translateParamsToString
(
parameters
)
{
const
keySet
=
new
Set
([
'
-s class
'
,
'
-s notClass
'
,
'
-s suite
'
,
'
-s itName
'
,
'
-s level
'
,
'
-s testType
'
,
'
-s size
'
,
'
-s timeout
'
,
'
-s package
'
])
let
targetParams
=
''
;
for
(
const
key
in
parameters
)
{
if
(
keySet
.
has
(
key
))
{
targetParams
+=
'
'
+
key
+
'
'
+
parameters
[
key
]
}
}
return
targetParams
.
trim
()
}
async
function
onAbilityCreateCallback
()
{
console
.
log
(
'
onAbilityCreateCallback
'
);
}
async
function
addAbilityMonitorCallback
(
err
:
any
)
{
console
.
info
(
'
addAbilityMonitorCallback :
'
+
JSON
.
stringify
(
err
))
}
export
default
class
OpenHarmonyTestRunner
implements
TestRunner
{
constructor
()
{
}
onPrepare
()
{
console
.
info
(
'
OpenHarmonyTestRunner OnPrepare
'
)
}
onRun
()
{
console
.
log
(
'
OpenHarmonyTestRunner onRun run
'
)
abilityDelegatorArguments
=
AbilityDelegatorRegistry
.
getArguments
()
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
()
let
lMonitor
=
{
abilityName
:
testAbilityName
,
onAbilityCreate
:
onAbilityCreateCallback
,
};
var
testAbilityName
=
abilityDelegatorArguments
.
parameters
[
'
-p
'
]
+
'
.TestAbility
'
abilityDelegator
.
addAbilityMonitor
(
lMonitor
,
addAbilityMonitorCallback
)
var
cmd
=
'
aa start -d 0 -a
'
+
testAbilityName
+
'
-b
'
+
abilityDelegatorArguments
.
bundleName
cmd
+=
'
'
+
translateParamsToString
(
abilityDelegatorArguments
.
parameters
)
console
.
info
(
'
cmd :
'
+
cmd
)
abilityDelegator
.
executeShellCommand
(
cmd
,
(
err
:
any
,
d
:
any
)
=>
{
console
.
info
(
'
executeShellCommand : err :
'
+
JSON
.
stringify
(
err
));
console
.
info
(
'
executeShellCommand : data :
'
+
d
.
stdResult
);
console
.
info
(
'
executeShellCommand : data :
'
+
d
.
exitCode
);
})
console
.
info
(
'
OpenHarmonyTestRunner onRun call abilityDelegator.getAppContext
'
)
var
context
=
abilityDelegator
.
getAppContext
()
console
.
info
(
'
getAppContext :
'
+
JSON
.
stringify
(
context
))
console
.
info
(
'
OpenHarmonyTestRunner onRun end
'
)
}
};
\ No newline at end of file
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/test/FmsFormStateNotifyInvisible.test.ets
已删除
100644 → 0
浏览文件 @
3413a1fd
/*
* 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
featureAbility
from
"@ohos.ability.featureAbility"
;
import
commonEvent
from
'@ohos.commonEvent'
;
import
{
describe
,
afterEach
,
beforeEach
,
expect
,
it
}
from
'@ohos/hypium'
var
onAcquiredForm_Event
=
{
events
:
[
"FMS_FormOnAcquired_commonEvent"
],
};
var
onDeletedFormEvent
=
{
events
:
[
"FMS_FormOnDeleted_commonEvent"
],
};
var
onStateFormEvent
=
{
events
:
[
"FMS_FormOnState_commonEvent"
],
};
var
onSupplyEvent
=
{
events
:
[
"FMS_FormSupply_commonEvent"
],
};
const
unsubscribeCallback
=
(
tcNumber
)
=>
{
console
.
info
(
`====>${tcNumber} unsubscribeCallback====>`
);
}
var
deleteForm_Event
=
"FMS_FormDelete_commonEvent"
;
var
subscriberOnAcquired
;
var
subscriberDel
;
var
subscriberOnState
;
var
subscriberSupply
;
export
default
function
test
()
{
describe
(
`FmsStateFormTest`
,
()
=>
{
beforeEach
(
async
()
=>
{
subscriberOnAcquired
=
await
commonEvent
.
createSubscriber
(
onAcquiredForm_Event
);
subscriberDel
=
await
commonEvent
.
createSubscriber
(
onDeletedFormEvent
);
subscriberOnState
=
await
commonEvent
.
createSubscriber
(
onStateFormEvent
);
subscriberSupply
=
await
commonEvent
.
createSubscriber
(
onSupplyEvent
);
await
sleep
(
1000
);
})
afterEach
(
async
()
=>
{
commonEvent
.
unsubscribe
(
subscriberOnAcquired
,
()
=>
unsubscribeCallback
(
"afterEach unsubscribe subscriberOnAcquired"
));
commonEvent
.
unsubscribe
(
subscriberDel
,
()
=>
unsubscribeCallback
(
"afterEach unsubscribe subscriberDel"
));
commonEvent
.
unsubscribe
(
subscriberOnState
,
()
=>
unsubscribeCallback
(
"afterEach unsubscribe subscriberOnState"
));
commonEvent
.
unsubscribe
(
subscriberSupply
,
()
=>
unsubscribeCallback
(
"afterEach unsubscribe subscriberSupply"
));
let
wantInfo
=
{
want
:
{
bundleName
:
"com.ohos.st.formstatenotifyinvisibletest"
,
abilityName
:
"com.ohos.st.formstatenotifyinvisibletest.TestAbility"
}
}
await
featureAbility
.
startAbility
(
wantInfo
)
.
then
((
data
)
=>
{
console
.
log
(
"FMS_notifyInvisibleForms startAbility data : "
+
JSON
.
stringify
(
data
));
})
.
catch
((
err
)
=>
{
console
.
log
(
"FMS_notifyInvisibleForms startAbility err : "
+
JSON
.
stringify
(
err
));
})
await
sleep
(
1000
);
})
/**
* @tc.number: FMS_notifyInvisibleForms_0200
* @tc.name: The form user does not have permission.
* @tc.desc: 1.The form user calls the invisible notification interface.
* 2.Verify the result of the invisible notification interface.
*/
it
(
`FMS_notifyInvisibleForms_0200`
,
0
,
async
(
done
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_0200 start`
);
function
onStateCallBack
(
_
,
data
)
{
console
.
info
(
"!!!====>FMS_notifyInvisibleForms_0200 onStateCallBack data:====>"
+
JSON
.
stringify
(
data
));
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormOnState_commonEvent"
);
expect
(
data
.
data
)
.
assertEqual
(
"2"
);
commonEvent
.
unsubscribe
(
subscriberOnState
,
()
=>
unsubscribeOnStateCallback
(
"FMS_notifyInvisibleForms_0200"
));
setTimeout
(
function
()
{
console
.
info
(
'FMS_notifyInvisibleForms_0200 onStateCallBack end'
);
console
.
log
(
`FMS_notifyInvisibleForms_0200 end`
);
done
();
},
1000
)
}
commonEvent
.
subscribe
(
subscriberOnState
,
onStateCallBack
);
console
.
log
(
`FMS_notifyInvisibleForms_0200 featureAbility.startAbility again start`
);
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostnoperm"
,
abilityName
:
"com.ohos.st.formsystemhostnoperm.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestservicea.hmservice"
,
"ability"
:
"com.form.formsystemtestservicea.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"stateForm"
:
"invisible"
,
"stateIds"
:
[
"1"
],
"isCreate"
:
false
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_0200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_0200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
});
console
.
log
(
`FMS_notifyInvisibleForms_0200 featureAbility.startAbility again end`
);
});
/**
* @tc.number: FMS_notifyInvisibleForms_0300
* @tc.name: The length of the formId list is 0 (no formId)
* @tc.desc: 1.The form user calls the invisible notification interface.
* 2.Verify the result of the invisible notification interface.
*/
it
(
`FMS_notifyInvisibleForms_0300`
,
0
,
async
(
done
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_0300 start`
);
function
onStateCallBack
(
_
,
data
)
{
console
.
info
(
"!!!====>FMS_notifyInvisibleForms_0300 onStateCallBack data:====>"
+
JSON
.
stringify
(
data
));
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormOnState_commonEvent"
);
expect
(
data
.
data
)
.
assertEqual
(
"7"
);
commonEvent
.
unsubscribe
(
subscriberOnState
,
()
=>
unsubscribeOnStateCallback
(
"FMS_notifyInvisibleForms_0300"
))
setTimeout
(
function
()
{
console
.
info
(
'FMS_notifyInvisibleForms_0300 delPublishCallBack end'
);
console
.
log
(
`FMS_notifyInvisibleForms_0300 end`
);
done
();
},
100
)
}
commonEvent
.
subscribe
(
subscriberOnState
,
onStateCallBack
);
console
.
log
(
`FMS_notifyInvisibleForms_0300 featureAbility.startAbility start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostg"
,
abilityName
:
"com.ohos.st.formsystemhostg.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestservicea.hmservice"
,
"ability"
:
"com.form.formsystemtestservicea.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"stateForm"
:
"invisible"
,
"stateIds"
:
[],
"isCreate"
:
false
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_0300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_0300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
});
console
.
log
(
`FMS_notifyInvisibleForms_0300 featureAbility.startAbility end`
);
});
/**
* @tc.number: FMS_notifyInvisibleForms_0400
* @tc.name: formID id is error(formID < 0)
* @tc.desc: 1.The form user calls the invisible notification interface.
* 2.Verify the result of the invisible notification interface.
*/
it
(
`FMS_notifyInvisibleForms_0400`
,
0
,
async
(
done
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_0400 start`
);
function
onStateCallBack
(
_
,
data
)
{
console
.
info
(
"!!!====>FMS_notifyInvisibleForms_0400 onStateCallBack data:====>"
+
JSON
.
stringify
(
data
));
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormOnState_commonEvent"
);
expect
(
data
.
data
)
.
assertEqual
(
"0"
);
commonEvent
.
unsubscribe
(
subscriberOnState
,
()
=>
unsubscribeOnStateCallback
(
"FMS_notifyInvisibleForms_0400"
))
setTimeout
(
function
()
{
console
.
info
(
'FMS_notifyInvisibleForms_0400 delPublishCallBack end'
);
console
.
log
(
`FMS_notifyInvisibleForms_0400 end`
);
done
();
},
100
)
}
commonEvent
.
subscribe
(
subscriberOnState
,
onStateCallBack
);
console
.
log
(
`FMS_notifyInvisibleForms_0400 featureAbility.startAbility start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostg"
,
abilityName
:
"com.ohos.st.formsystemhostg.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestservicea.hmservice"
,
"ability"
:
"com.form.formsystemtestservicea.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"stateForm"
:
"invisible"
,
"stateIds"
:
[
"-1"
],
"isCreate"
:
false
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_0400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_0400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
});
console
.
log
(
`FMS_notifyInvisibleForms_0400 featureAbility.startAbility end`
);
});
/**
* @tc.number: FMS_notifyInvisibleForms_0500
* @tc.name: formID id is error(formID == 0)
* @tc.desc: 1.The form user calls the invisible notification interface.
* 2.Verify the result of the invisible notification interface.
*/
it
(
`FMS_notifyInvisibleForms_0500`
,
0
,
async
(
done
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_0500 start`
);
function
onStateCallBack
(
_
,
data
)
{
console
.
info
(
"!!!====>FMS_notifyInvisibleForms_0500 onStateCallBack data:====>"
+
JSON
.
stringify
(
data
));
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormOnState_commonEvent"
);
expect
(
data
.
data
)
.
assertEqual
(
"0"
);
commonEvent
.
unsubscribe
(
subscriberOnState
,
()
=>
unsubscribeOnStateCallback
(
"FMS_notifyInvisibleForms_0500"
))
setTimeout
(
function
()
{
console
.
info
(
'FMS_notifyInvisibleForms_0500 delPublishCallBack end'
);
console
.
log
(
`FMS_notifyInvisibleForms_0500 end`
);
done
();
},
100
)
}
commonEvent
.
subscribe
(
subscriberOnState
,
onStateCallBack
);
console
.
log
(
`FMS_notifyInvisibleForms_0500 featureAbility.startAbility start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostg"
,
abilityName
:
"com.ohos.st.formsystemhostg.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestservicea.hmservice"
,
"ability"
:
"com.form.formsystemtestservicea.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"stateForm"
:
"invisible"
,
"stateIds"
:
[
"0"
],
"isCreate"
:
false
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_0500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_0500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
});
console
.
log
(
`FMS_notifyInvisibleForms_0500 featureAbility.startAbility end`
);
});
/**
* @tc.number: FMS_notifyInvisibleForms_0600
* @tc.name: formID id is error because formId is not self
* @tc.desc: 1.The form user calls the invisible notification interface.
* 2.Verify the result of the invisible notification interface.
*/
it
(
`FMS_notifyInvisibleForms_0600`
,
0
,
async
(
done
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_0600 start`
);
let
formId
;
function
onStateCallBack
(
_
,
data
)
{
console
.
info
(
"!!!====>FMS_notifyInvisibleForms_0600 onStateCallBack data:====>"
+
JSON
.
stringify
(
data
));
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormOnState_commonEvent"
);
expect
(
data
.
data
)
.
assertEqual
(
"0"
);
commonEvent
.
unsubscribe
(
subscriberOnState
,
()
=>
unsubscribeOnStateCallback
(
"FMS_notifyInvisibleForms_0600"
));
let
commonEventPublishData
=
{
data
:
formId
};
commonEvent
.
publish
(
deleteForm_Event
,
commonEventPublishData
,
(
err
)
=>
{
console
.
info
(
'FMS_notifyInvisibleForms_0600 publish'
+
JSON
.
stringify
(
err
));
done
()
});
}
async
function
onAcquiredCallBack
(
_
,
data
)
{
console
.
info
(
"!!!====>FMS_notifyInvisibleForms_0600 onAcquiredCallBack data:====>"
+
JSON
.
stringify
(
data
));
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormOnAcquired_commonEvent"
);
commonEvent
.
unsubscribe
(
subscriberOnAcquired
,
()
=>
unsubscribeOnAcquiredCallback
(
"FMS_notifyInvisibleForms_0600"
))
formId
=
data
.
data
;
commonEvent
.
subscribe
(
subscriberOnState
,
onStateCallBack
);
console
.
log
(
`FMS_notifyInvisibleForms_0600 featureAbility.startAbility again start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostg"
,
abilityName
:
"com.ohos.st.formsystemhostg.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestservicea.hmservice"
,
"ability"
:
"com.form.formsystemtestservicea.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"stateForm"
:
"invisible"
,
"stateIds"
:
[
formId
],
"isCreate"
:
false
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_0600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_0600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
});
console
.
log
(
`FMS_notifyInvisibleForms_0600 featureAbility.startAbility again end`
);
}
commonEvent
.
subscribe
(
subscriberOnAcquired
,
onAcquiredCallBack
);
console
.
log
(
`FMS_notifyInvisibleForms_0600 featureAbility.startAbility start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostf"
,
abilityName
:
"com.ohos.st.formsystemhostf.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestservicea.hmservice"
,
"ability"
:
"com.form.formsystemtestservicea.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"isCreate"
:
true
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_0600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_0600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
expect
()
.
assertFail
();
done
();
});
console
.
log
(
`FMS_notifyInvisibleForms_0600 featureAbility.startAbility end`
);
});
/**
* @tc.number: FMS_notifyInvisibleForms_0700
* @tc.name: form has been deleted
* @tc.desc: 1.The form user calls the invisible notification interface.
* 2.Verify the result of the invisible notification interface.
*/
it
(
`FMS_notifyInvisibleForms_0700`
,
0
,
async
(
done
)
=>
{
console
.
info
(
`FMS_notifyInvisibleForms_0700 start`
);
let
hostFormId
;
const
onSupplyCallback
=
(
_
,
data
)
=>
{
if
(
data
.
parameters
.
kind
!=
"onVisibilityChange"
)
{
return
;
}
console
.
debug
(
"====>FMS_notifyInvisibleForms_0700 onSupplyCallback data:====>"
+
JSON
.
stringify
(
data
));
expect
()
.
assertFail
();
}
const
onInvisibleCallback
=
(
_
,
data
)
=>
{
if
(
data
.
parameters
.
kind
!=
"invisible"
)
{
return
;
}
console
.
debug
(
"====>FMS_notifyInvisibleForms_0700 onInvisibleCallback data:====>"
+
JSON
.
stringify
(
data
));
expect
(
data
.
data
)
.
assertEqual
(
"0"
);
expect
(
data
.
parameters
.
formId
)
.
assertEqual
(
hostFormId
);
commonEvent
.
unsubscribe
(
subscriberOnState
,
()
=>
unsubscribeOnStateCallback
(
"FMS_notifyInvisibleForms_0700"
));
setTimeout
(()
=>
{
commonEvent
.
unsubscribe
(
subscriberSupply
,
()
=>
unsubscribeSupplyCallback
(
"FMS_notifyInvisibleForms_0700"
));
done
();
},
2000
);
}
const
onDeleteCallback
=
async
(
_
,
data
)
=>
{
console
.
debug
(
"====>FMS_notifyInvisibleForms_0700 onDeleteCallback data:====>"
+
JSON
.
stringify
(
data
));
hostFormId
=
data
.
parameters
.
formId
;
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostg"
,
abilityName
:
"com.ohos.st.formsystemhostg.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestservicef.hmservice"
,
"ability"
:
"com.form.formsystemtestservicef.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"stateForm"
:
"invisible"
,
"stateIds"
:
[
hostFormId
],
"isCreate"
:
false
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
debug
(
`FMS_notifyInvisibleForms_0700 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
debug
(
`FMS_notifyInvisibleForms_0700 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
});
commonEvent
.
unsubscribe
(
subscriberDel
,
()
=>
{
console
.
info
(
"====>FMS_notifyInvisibleForms_0700 unSubscribeDelCallback====>"
);
});
}
commonEvent
.
subscribe
(
subscriberDel
,
onDeleteCallback
);
commonEvent
.
subscribe
(
subscriberOnState
,
onInvisibleCallback
);
commonEvent
.
subscribe
(
subscriberSupply
,
onSupplyCallback
);
console
.
info
(
`FMS_notifyInvisibleForms_0700 featureAbility.startAbility start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostg"
,
abilityName
:
"com.ohos.st.formsystemhostg.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestservicef.hmservice"
,
"ability"
:
"com.form.formsystemtestservicef.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"deleteForm"
:
true
,
"deleteId"
:
"self"
,
"isCreate"
:
true
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
debug
(
`FMS_notifyInvisibleForms_0700 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
debug
(
`FMS_notifyInvisibleForms_0700 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
});
});
/**
* @tc.number: FMS_notifyInvisibleForms_0800
* @tc.name: The form provider is the system application and config When form visiblenotify is true,
* the form provider can be notified that the form is invisible.
* @tc.desc: 1.The form user calls the invisible notification interface.
* 2.Verify the result of the invisible notification interface.
*/
it
(
`FMS_notifyInvisibleForms_0800`
,
0
,
async
(
done
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_0800 start`
);
let
formIdInvisible
;
let
formIdVisible
;
let
onSupplyCount
=
0
;
function
onSupplyCallBack
(
_
,
data
)
{
if
(
data
.
parameters
.
kind
==
"onVisibilityChange"
)
{
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormSupply_commonEvent"
);
console
.
debug
(
"====>FMS_notifyInvisibleForms_0800 onSupplyCallBack====>"
+
JSON
.
stringify
(
data
));
onSupplyCount
++
;
if
(
onSupplyCount
==
2
)
{
commonEvent
.
unsubscribe
(
subscriberSupply
,
()
=>
unsubscribeSupplyCallback
(
"FMS_notifyInvisibleForms_0800"
));
}
if
(
formIdInvisible
&&
formIdVisible
)
{
let
commonEventPublishData
=
{
data
:
formIdInvisible
};
commonEvent
.
publish
(
deleteForm_Event
,
commonEventPublishData
,
(
err
)
=>
{
console
.
info
(
'FMS_notifyInvisibleForms_0800 publish'
+
JSON
.
stringify
(
err
));
done
()
});
}
}
}
function
OnInvisibleCallBack
(
_
,
data
)
{
console
.
info
(
"!!!====>FMS_notifyInvisibleForms_0800 OnInvisibleCallBack data:====>"
+
JSON
.
stringify
(
data
));
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormOnState_commonEvent"
);
expect
(
data
.
data
)
.
assertEqual
(
"0"
);
formIdInvisible
=
data
.
parameters
.
formId
;
commonEvent
.
unsubscribe
(
subscriberOnState
,
()
=>
unsubscribeOnStateCallback
(
"FMS_notifyInvisibleForms_0800"
));
if
(
formIdInvisible
&&
formIdVisible
&&
onSupplyCount
==
2
)
{
let
commonEventPublishData
=
{
data
:
formIdInvisible
};
commonEvent
.
publish
(
deleteForm_Event
,
commonEventPublishData
,
(
err
)
=>
{
console
.
info
(
'FMS_notifyInvisibleForms_0800 publish'
+
JSON
.
stringify
(
err
));
done
()
});
}
}
async
function
onVisibleCallBack
(
_
,
data
)
{
console
.
info
(
"!!!====>FMS_notifyInvisibleForms_0800 onVisibleCallBack data:====>"
+
JSON
.
stringify
(
data
));
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormOnState_commonEvent"
);
expect
(
data
.
data
)
.
assertEqual
(
"0"
);
commonEvent
.
unsubscribe
(
subscriberOnState
,
()
=>
unsubscribeOnStateCallback
(
"FMS_notifyInvisibleForms_0800"
));
formIdVisible
=
data
.
parameters
.
formId
;
subscriberOnState
=
await
commonEvent
.
createSubscriber
(
onStateFormEvent
);
commonEvent
.
subscribe
(
subscriberOnState
,
OnInvisibleCallBack
);
console
.
log
(
`FMS_notifyInvisibleForms_0800 featureAbility.startAbility again start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostg"
,
abilityName
:
"com.ohos.st.formsystemhostg.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestservicea.hmservice"
,
"ability"
:
"com.form.formsystemtestservicea.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"stateForm"
:
"invisible"
,
"stateIds"
:
[
formIdVisible
],
"isCreate"
:
false
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_0800 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_0800 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
});
console
.
log
(
`FMS_notifyInvisibleForms_0800 featureAbility.startAbility again end`
);
}
commonEvent
.
subscribe
(
subscriberOnState
,
onVisibleCallBack
);
commonEvent
.
subscribe
(
subscriberSupply
,
onSupplyCallBack
);
console
.
log
(
`FMS_notifyInvisibleForms_0800 featureAbility.startAbility start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostg"
,
abilityName
:
"com.ohos.st.formsystemhostg.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestservicea.hmservice"
,
"ability"
:
"com.form.formsystemtestservicea.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"stateForm"
:
"visible"
,
"stateIds"
:
[
"self"
],
"isCreate"
:
true
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_0800 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_0800 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
});
console
.
log
(
`FMS_notifyInvisibleForms_0800 featureAbility.startAbility end`
);
});
});
}
const
sleep
=
async
delay
=>
{
return
new
Promise
((
resolve
,
_
)
=>
{
setTimeout
(
async
()
=>
{
resolve
(
0
);
},
delay
);
});
};
const
delPublishCallback
=
async
(
tcNumber
,
done
)
=>
{
console
.
info
(
`${tcNumber} delPublishCallBack start`
);
setTimeout
(
function
()
{
console
.
info
(
`${tcNumber} delPublishCallBack end`
);
done
();
},
1000
);
}
const
unsubscribeOnStateCallback
=
(
tcNumber
)
=>
{
console
.
debug
(
`====>${tcNumber} unsubscribeOnStateCallback====>`
);
}
const
unsubscribeOnAcquiredCallback
=
(
tcNumber
)
=>
{
console
.
info
(
`====>${tcNumber} unsubscribeOnAcquiredCallback====>`
);
}
const
unsubscribeSupplyCallback
=
(
tcNumber
)
=>
{
console
.
debug
(
`====>${tcNumber} unSubscribeSupplyCallback====>`
);
}
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/test/List.test.ets
已删除
100644 → 0
浏览文件 @
3413a1fd
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import test from './FmsFormStateNotifyInvisible.test.ets';
export default function testsuite() {
test();
}
\ No newline at end of file
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/resources/base/element/string.json
已删除
100644 → 0
浏览文件 @
3413a1fd
{
"string"
:
[
{
"name"
:
"entry_MainAbility"
,
"value"
:
"forminvisiblestatetest"
},
{
"name"
:
"description_mainability"
,
"value"
:
"ETS_Empty Ability"
},
{
"name"
:
"TestAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"TestAbility_label"
,
"value"
:
"label"
}
]
}
\ No newline at end of file
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/resources/base/media/icon.png
已删除
100644 → 0
浏览文件 @
3413a1fd
6.6 KB
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/signature/openharmony_sx.p7b
已删除
100644 → 0
浏览文件 @
3413a1fd
文件已删除
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/BUILD.gn
已删除
100644 → 0
浏览文件 @
3413a1fd
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsFormStateNotifyInvisible2Test") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_js_test_assets",
":hjs_demo_resources",
]
ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsFormStateNotifyInvisible2Test"
subsystem_name = "ability"
part_name = "form_fwk"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/ets/MainAbility"
}
ohos_js_assets("hjs_demo_js_test_assets") {
source_dir = "./entry/src/main/ets/TestAbility"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json"
}
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/Test.json
已删除
100644 → 0
浏览文件 @
3413a1fd
{
"description"
:
"Configuration for hjunit demo Tests"
,
"driver"
:
{
"type"
:
"OHJSUnitTest"
,
"test-timeout"
:
"300000"
,
"bundle-name"
:
"com.ohos.st.formstatenotifyinvisibletest2"
,
"package-name"
:
"com.ohos.st.formstatenotifyinvisibletest2"
,
"shell-timeout"
:
"600000"
,
"testcase-timeout"
:
"30000"
},
"kits"
:
[
{
"test-file-name"
:
[
"ActsFormStateNotifyInvisible2Test.hap"
,
"FormSystemHostG.hap"
,
"FormSupplyAppA.hap"
,
"FormSupplyAppB.hap"
,
"FormSupplyAppD.hap"
,
"FormSupplyAppF.hap"
,
"FormSupplyAppNS.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
}
]
}
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/config.json
已删除
100644 → 0
浏览文件 @
3413a1fd
{
"app"
:
{
"bundleName"
:
"com.ohos.st.formstatenotifyinvisibletest2"
,
"vendor"
:
"ohos"
,
"version"
:
{
"code"
:
1000000
,
"name"
:
"1.0.0"
},
"apiVersion"
:
{
"compatible"
:
7
,
"releaseType"
:
"Release"
,
"target"
:
7
}
},
"deviceConfig"
:
{},
"module"
:
{
"package"
:
"com.ohos.st.formstatenotifyinvisibletest2"
,
"name"
:
".FormStateSTApp"
,
"mainAbility"
:
".MainAbility"
,
"deviceType"
:
[
"default"
,
"tablet"
],
"distro"
:
{
"deliveryWithInstall"
:
true
,
"moduleName"
:
"entry"
,
"moduleType"
:
"entry"
,
"installationFree"
:
false
},
"abilities"
:
[
{
"skills"
:
[
{
"entities"
:
[
"entity.system.home"
],
"actions"
:
[
"action.system.home"
]
}
],
"visible"
:
true
,
"name"
:
".MainAbility"
,
"srcPath"
:
"MainAbility"
,
"srcLanguage"
:
"ets"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:description_mainability"
,
"label"
:
"$string:entry_MainAbility"
,
"type"
:
"page"
,
"launchType"
:
"standard"
},
{
"orientation"
:
"unspecified"
,
"formsEnabled"
:
false
,
"name"
:
".TestAbility"
,
"srcLanguage"
:
"ets"
,
"srcPath"
:
"TestAbility"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:TestAbility_desc"
,
"label"
:
"$string:TestAbility_label"
,
"type"
:
"page"
,
"visible"
:
true
,
"launchType"
:
"singleton"
}
],
"defPermissions"
:
[
{
"availableScope"
:
[],
"grantMode"
:
"system_grant"
,
"name"
:
"FMS_FormDelete_commonEvent"
},
{
"availableScope"
:
[],
"grantMode"
:
"system_grant"
,
"name"
:
"FMS_FormOnAcquired_commonEvent"
},
{
"availableScope"
:
[],
"grantMode"
:
"system_grant"
,
"name"
:
"FMS_FormOnError_commonEvent"
},
{
"availableScope"
:
[],
"grantMode"
:
"system_grant"
,
"name"
:
"FMS_FormOnDeleted_commonEvent"
},
{
"availableScope"
:
[],
"grantMode"
:
"system_grant"
,
"name"
:
"FMS_FormOnState_commonEvent"
},
{
"availableScope"
:
[],
"grantMode"
:
"system_grant"
,
"name"
:
"FMS_FormSupply_commonEvent"
}
],
"reqPermissions"
:
[
{
"name"
:
"FMS_FormOnAcquired_commonEvent"
,
"reason"
:
"need use onAcquired commonEvent"
},
{
"name"
:
"FMS_FormDelete_commonEvent"
,
"reason"
:
"need use delete commonEvent"
},
{
"name"
:
"FMS_FormOnError_commonEvent"
,
"reason"
:
"need use OnError commonEvent"
},
{
"name"
:
"FMS_FormOnDeleted_commonEvent"
,
"reason"
:
"need use OnDeleted commonEvent"
},
{
"name"
:
"FMS_FormOnState_commonEvent"
,
"reason"
:
"need use OnState commonEvent"
},
{
"name"
:
"FMS_FormSupply_commonEvent"
,
"reason"
:
"need use FormSupply commonEvent"
},
{
"name"
:
"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
,
"reason"
:
"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
},
{
"name"
:
"ohos.permission.CLEAN_BACKGROUND_PROCESSES"
,
"reason"
:
"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES"
},
{
"name"
:
"ohos.permission.START_ABILITIES_FROM_BACKGROUND"
,
"reason"
:
"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND"
}
],
"js"
:
[
{
"mode"
:
{
"syntax"
:
"ets"
,
"type"
:
"pageAbility"
},
"pages"
:
[
"pages/index"
],
"name"
:
".MainAbility"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
},
{
"mode"
:
{
"syntax"
:
"ets"
,
"type"
:
"pageAbility"
},
"pages"
:
[
"pages/index"
],
"name"
:
".TestAbility"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
}
]
}
}
\ No newline at end of file
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/MainAbility/app.ets
已删除
100644 → 0
浏览文件 @
3413a1fd
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('[FormComponent] Application onCreate')
},
onDestroy() {
console.info('[FormComponent] Application onDestroy')
},
}
\ No newline at end of file
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/MainAbility/pages/index.ets
已删除
100644 → 0
浏览文件 @
3413a1fd
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
build() {
Flex({
direction: FlexDirection.Column,
alignItems: ItemAlign.Center,
justifyContent: FlexAlign.Center
}) {
Text('Fms Main Ability Test')
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
.height('100%')
}
}
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/TestAbility/app.ets
已删除
100644 → 0
浏览文件 @
3413a1fd
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
export default {
onCreate() {
console.info('Application onCreate')
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
},
onDestroy() {
console.info('Application onDestroy')
},
}
\ No newline at end of file
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/TestAbility/pages/index.ets
已删除
100644 → 0
浏览文件 @
3413a1fd
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import router from '@system.router';
@Entry
@Component
struct Index {
aboutToAppear() {
console.info('TestAbility index aboutToAppear')
}
@State message: string = 'Hello World'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('next page')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.width('35%')
.height('5%')
.onClick(()=>{
})
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
已删除
100644 → 0
浏览文件 @
3413a1fd
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
TestRunner
from
'
@ohos.application.testRunner
'
import
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
var
abilityDelegator
=
undefined
var
abilityDelegatorArguments
=
undefined
function
translateParamsToString
(
parameters
)
{
const
keySet
=
new
Set
([
'
-s class
'
,
'
-s notClass
'
,
'
-s suite
'
,
'
-s itName
'
,
'
-s level
'
,
'
-s testType
'
,
'
-s size
'
,
'
-s timeout
'
,
'
-s package
'
])
let
targetParams
=
''
;
for
(
const
key
in
parameters
)
{
if
(
keySet
.
has
(
key
))
{
targetParams
+=
'
'
+
key
+
'
'
+
parameters
[
key
]
}
}
return
targetParams
.
trim
()
}
async
function
onAbilityCreateCallback
()
{
console
.
log
(
'
onAbilityCreateCallback
'
);
}
async
function
addAbilityMonitorCallback
(
err
:
any
)
{
console
.
info
(
'
addAbilityMonitorCallback :
'
+
JSON
.
stringify
(
err
))
}
export
default
class
OpenHarmonyTestRunner
implements
TestRunner
{
constructor
()
{
}
onPrepare
()
{
console
.
info
(
'
OpenHarmonyTestRunner OnPrepare
'
)
}
onRun
()
{
console
.
log
(
'
OpenHarmonyTestRunner onRun run
'
)
abilityDelegatorArguments
=
AbilityDelegatorRegistry
.
getArguments
()
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
()
let
lMonitor
=
{
abilityName
:
testAbilityName
,
onAbilityCreate
:
onAbilityCreateCallback
,
};
var
testAbilityName
=
abilityDelegatorArguments
.
parameters
[
'
-p
'
]
+
'
.TestAbility
'
abilityDelegator
.
addAbilityMonitor
(
lMonitor
,
addAbilityMonitorCallback
)
var
cmd
=
'
aa start -d 0 -a
'
+
testAbilityName
+
'
-b
'
+
abilityDelegatorArguments
.
bundleName
cmd
+=
'
'
+
translateParamsToString
(
abilityDelegatorArguments
.
parameters
)
console
.
info
(
'
cmd :
'
+
cmd
)
abilityDelegator
.
executeShellCommand
(
cmd
,
(
err
:
any
,
d
:
any
)
=>
{
console
.
info
(
'
executeShellCommand : err :
'
+
JSON
.
stringify
(
err
));
console
.
info
(
'
executeShellCommand : data :
'
+
d
.
stdResult
);
console
.
info
(
'
executeShellCommand : data :
'
+
d
.
exitCode
);
})
console
.
info
(
'
OpenHarmonyTestRunner onRun call abilityDelegator.getAppContext
'
)
var
context
=
abilityDelegator
.
getAppContext
()
console
.
info
(
'
getAppContext :
'
+
JSON
.
stringify
(
context
))
console
.
info
(
'
OpenHarmonyTestRunner onRun end
'
)
}
};
\ No newline at end of file
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/test/FmsFormStateNotifyInvisible2.test.ets
已删除
100644 → 0
浏览文件 @
3413a1fd
/*
* 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
featureAbility
from
"@ohos.ability.featureAbility"
;
import
commonEvent
from
'@ohos.commonEvent'
;
import
{
beforeEach
,
afterEach
,
describe
,
expect
,
it
}
from
'@ohos/hypium'
var
onAcquiredForm_Event
=
{
events
:
[
"FMS_FormOnAcquired_commonEvent"
],
};
var
onStateFormEvent
=
{
events
:
[
"FMS_FormOnState_commonEvent"
],
};
var
onSupplyEvent
=
{
events
:
[
"FMS_FormSupply_commonEvent"
],
};
const
unsubscribeCallback
=
(
tcNumber
)
=>
{
console
.
info
(
`====>${tcNumber} unsubscribeCallback====>`
);
}
var
deleteForm_Event
=
"FMS_FormDelete_commonEvent"
;
var
subscriberOnAcquired
;
var
subscriberOnState
;
var
subscriberSupply
;
export
default
function
test
()
{
describe
(
`FmsStateFormTest`
,
()
=>
{
beforeEach
(
async
()
=>
{
subscriberOnAcquired
=
await
commonEvent
.
createSubscriber
(
onAcquiredForm_Event
);
subscriberOnState
=
await
commonEvent
.
createSubscriber
(
onStateFormEvent
);
subscriberSupply
=
await
commonEvent
.
createSubscriber
(
onSupplyEvent
);
await
sleep
(
1000
);
})
afterEach
(
async
()
=>
{
commonEvent
.
unsubscribe
(
subscriberOnAcquired
,
()
=>
unsubscribeCallback
(
"afterEach unsubscribe subscriberOnAcquired"
));
commonEvent
.
unsubscribe
(
subscriberOnState
,
()
=>
unsubscribeCallback
(
"afterEach unsubscribe subscriberOnState"
));
commonEvent
.
unsubscribe
(
subscriberSupply
,
()
=>
unsubscribeCallback
(
"afterEach unsubscribe subscriberSupply"
));
let
wantInfo
=
{
want
:
{
bundleName
:
"com.ohos.st.formstatenotifyinvisibletest2"
,
abilityName
:
"com.ohos.st.formstatenotifyinvisibletest2.TestAbility"
}
}
await
featureAbility
.
startAbility
(
wantInfo
)
.
then
((
data
)
=>
{
console
.
log
(
"FMS_notifyInvisibleForms2 startAbility data : "
+
JSON
.
stringify
(
data
));
})
.
catch
((
err
)
=>
{
console
.
log
(
"FMS_notifyInvisibleForms2 startAbility err : "
+
JSON
.
stringify
(
err
));
})
await
sleep
(
1000
);
})
/**
* @tc.number: FMS_notifyInvisibleForms_0900
* @tc.name: There are correct and wrong formId in the form ID parameter list
* that informs that the form is invisible.
* @tc.desc: 1.The form user calls the invisible notification interface.
* 2.Verify the result of the invisible notification interface.
*/
it
(
`FMS_notifyInvisibleForms_0900`
,
0
,
async
(
done
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_0900 start`
);
let
formIdInvisible
;
let
formIdVisible
;
let
onSupplyCount
=
0
;
function
onSupplyCallBack
(
_
,
data
)
{
if
(
data
.
parameters
.
kind
==
"onVisibilityChange"
)
{
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormSupply_commonEvent"
);
console
.
debug
(
"====>FMS_notifyInvisibleForms_0900 onSupplyCallBack====>"
+
JSON
.
stringify
(
data
));
onSupplyCount
++
;
if
(
onSupplyCount
==
2
)
{
commonEvent
.
unsubscribe
(
subscriberSupply
,
()
=>
unsubscribeSupplyCallback
(
"FMS_notifyInvisibleForms_0900"
));
}
if
(
formIdInvisible
&&
formIdVisible
)
{
let
commonEventPublishData
=
{
data
:
formIdInvisible
};
commonEvent
.
publish
(
deleteForm_Event
,
commonEventPublishData
,
(
err
)
=>
{
console
.
info
(
'FMS_notifyInvisibleForms_0900 publish'
+
JSON
.
stringify
(
err
));
done
()
});
}
}
}
function
OnInvisibleCallBack
(
_
,
data
)
{
console
.
info
(
"!!!====>FMS_notifyInvisibleForms_0900 OnInvisibleCallBack data:====>"
+
JSON
.
stringify
(
data
));
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormOnState_commonEvent"
);
expect
(
data
.
data
)
.
assertEqual
(
"0"
);
formIdInvisible
=
data
.
parameters
.
formId
;
commonEvent
.
unsubscribe
(
subscriberOnState
,
()
=>
unsubscribeOnStateCallback
(
"FMS_notifyInvisibleForms_0900"
));
if
(
formIdInvisible
&&
formIdVisible
&&
onSupplyCount
==
2
)
{
let
commonEventPublishData
=
{
data
:
formIdInvisible
};
commonEvent
.
publish
(
deleteForm_Event
,
commonEventPublishData
,
(
err
)
=>
{
console
.
info
(
'FMS_notifyInvisibleForms_0900 publish'
+
JSON
.
stringify
(
err
));
done
()
});
}
}
async
function
onVisibleCallBack
(
_
,
data
)
{
console
.
info
(
"!!!====>FMS_notifyInvisibleForms_0900 onVisibleCallBack data:====>"
+
JSON
.
stringify
(
data
));
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormOnState_commonEvent"
);
expect
(
data
.
data
)
.
assertEqual
(
"0"
);
commonEvent
.
unsubscribe
(
subscriberOnState
,
()
=>
unsubscribeOnStateCallback
(
"FMS_notifyInvisibleForms_0900"
));
formIdVisible
=
data
.
parameters
.
formId
;
subscriberOnState
=
await
commonEvent
.
createSubscriber
(
onStateFormEvent
);
commonEvent
.
subscribe
(
subscriberOnState
,
OnInvisibleCallBack
);
console
.
log
(
`FMS_notifyInvisibleForms_0900 featureAbility.startAbility again start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostg"
,
abilityName
:
"com.ohos.st.formsystemhostg.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestservicea.hmservice"
,
"ability"
:
"com.form.formsystemtestservicea.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"stateForm"
:
"invisible"
,
"stateIds"
:
[
formIdVisible
,
"0"
],
"isCreate"
:
false
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_0900 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_0900 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
expect
()
.
assertFail
();
done
();
});
console
.
log
(
`FMS_notifyInvisibleForms_0900 featureAbility.startAbility again end`
);
}
commonEvent
.
subscribe
(
subscriberOnState
,
onVisibleCallBack
);
commonEvent
.
subscribe
(
subscriberSupply
,
onSupplyCallBack
);
console
.
log
(
`FMS_notifyInvisibleForms_0900 featureAbility.startAbility start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostg"
,
abilityName
:
"com.ohos.st.formsystemhostg.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestservicea.hmservice"
,
"ability"
:
"com.form.formsystemtestservicea.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"stateForm"
:
"visible"
,
"stateIds"
:
[
"self"
],
"isCreate"
:
true
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_0900 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_0900 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
expect
()
.
assertFail
();
done
();
});
console
.
log
(
`FMS_notifyInvisibleForms_0900 featureAbility.startAbility end`
);
});
/**
* @tc.number: FMS_notifyInvisibleForms_1000
* @tc.name: When the form provider is not a system application, notify the form to be invisible
* and do not pull up the form provider.
* @tc.desc: 1.The form user calls the invisible notification interface.
* 2.Verify the result of the invisible notification interface.
*/
it
(
`FMS_notifyInvisibleForms_1000`
,
0
,
async
(
done
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_1000 start`
);
function
onVisibleCallBack
(
_
,
data
)
{
if
(
data
.
parameters
.
kind
!=
"invisible"
)
{
return
;
}
console
.
info
(
"!!!====>FMS_notifyInvisibleForms_1000 onVisibleCallBack data:====>"
+
JSON
.
stringify
(
data
));
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormOnState_commonEvent"
);
expect
(
data
.
data
)
.
assertEqual
(
"0"
);
setTimeout
(
function
()
{
commonEvent
.
unsubscribe
(
subscriberOnState
,
()
=>
unsubscribeOnStateCallback
(
"FMS_notifyInvisibleForms_1000"
));
commonEvent
.
unsubscribe
(
subscriberSupply
,
()
=>
unsubscribeSupplyCallback
(
"FMS_notifyInvisibleForms_1000"
));
let
commonEventPublishData
=
{
data
:
data
.
parameters
.
formId
};
commonEvent
.
publish
(
deleteForm_Event
,
commonEventPublishData
,
()
=>
delPublishCallback
(
"FMS_notifyInvisibleForms_1000"
,
done
));
},
2000
);
}
function
onSupplyEventCallBack
(
_
,
data
)
{
if
(
data
.
parameters
.
kind
!=
"onVisibilityChange"
)
{
return
;
}
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormSupply_commonEvent"
);
commonEvent
.
unsubscribe
(
subscriberSupply
,
()
=>
unsubscribeSupplyCallback
(
"FMS_notifyInvisibleForms_1000"
));
console
.
debug
(
"====>FMS_notifyInvisibleForms_1000 onSupplyEventCallBack====>"
+
JSON
.
stringify
(
data
));
console
.
log
(
`FMS_notifyInvisibleForms_1000 error`
);
expect
()
.
assertFail
();
}
commonEvent
.
subscribe
(
subscriberOnState
,
onVisibleCallBack
);
commonEvent
.
subscribe
(
subscriberSupply
,
onSupplyEventCallBack
);
console
.
log
(
`FMS_notifyInvisibleForms_1000 featureAbility.startAbility start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostg"
,
abilityName
:
"com.ohos.st.formsystemhostg.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestservicenotsysapp.hmservice"
,
"ability"
:
"com.form.formsystemtestservicenotsysapp.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"stateForm"
:
"invisible"
,
"stateIds"
:
[
"self"
],
"isCreate"
:
true
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_1000 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_1000 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
expect
()
.
assertFail
();
done
();
});
console
.
log
(
`FMS_notifyInvisibleForms_1000 featureAbility.startAbility end`
);
});
/**
* @tc.number: FMS_notifyInvisibleForms_1100
* @tc.name: When formVisibleNotify is false in config.json,
* the form provider will not be pulled when the card is invisible.
* @tc.desc: 1.The form user calls the invisible notification interface.
* 2.Verify the result of the invisible notification interface.
*/
it
(
`FMS_notifyInvisibleForms_1100`
,
0
,
async
(
done
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_1100 start`
);
let
supplyFlag
=
false
;
let
formIdInvisible
;
let
formIdVisible
;
function
delPublishCallBack
(
_
,
data
)
{
console
.
info
(
"!!!====>FMS_notifyInvisibleForms_1100 delPublishCallBack====>"
);
setTimeout
(
function
()
{
commonEvent
.
unsubscribe
(
subscriberSupply
,
()
=>
unsubscribeSupplyCallback
(
"FMS_notifyInvisibleForms_1100"
));
if
(
supplyFlag
)
{
expect
()
.
assertFail
();
}
console
.
info
(
'FMS_notifyInvisibleForms_1100 delPublishCallBack end'
);
console
.
log
(
`FMS_notifyInvisibleForms_1100 end`
);
done
();
},
1000
);
}
function
onSupplyCallBack
(
_
,
data
)
{
if
(
data
.
parameters
.
kind
==
"onVisibilityChange"
)
{
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormSupply_commonEvent"
);
console
.
debug
(
"====>FMS_notifyInvisibleForms_1100 onSupplyCallBack====>"
+
JSON
.
stringify
(
data
));
supplyFlag
=
true
;
commonEvent
.
unsubscribe
(
subscriberSupply
,
()
=>
unsubscribeSupplyCallback
(
"FMS_notifyInvisibleForms_1100"
));
if
(
formIdInvisible
&&
formIdVisible
)
{
let
commonEventPublishData
=
{
data
:
formIdInvisible
};
commonEvent
.
publish
(
deleteForm_Event
,
commonEventPublishData
,
delPublishCallBack
);
}
}
}
function
OnInvisibleCallBack
(
_
,
data
)
{
console
.
info
(
"!!!====>FMS_notifyInvisibleForms_1100 OnInvisibleCallBack data:====>"
+
JSON
.
stringify
(
data
));
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormOnState_commonEvent"
);
expect
(
data
.
data
)
.
assertEqual
(
"0"
);
formIdInvisible
=
data
.
parameters
.
formId
;
commonEvent
.
unsubscribe
(
subscriberOnState
,
()
=>
unsubscribeOnStateCallback
(
"FMS_notifyInvisibleForms_1100"
));
if
(
formIdInvisible
&&
formIdVisible
)
{
let
commonEventPublishData
=
{
data
:
formIdInvisible
};
commonEvent
.
publish
(
deleteForm_Event
,
commonEventPublishData
,
delPublishCallBack
);
}
}
async
function
onVisibleCallBack
(
_
,
data
)
{
console
.
info
(
"!!!====>FMS_notifyInvisibleForms_1100 onVisibleCallBack data:====>"
+
JSON
.
stringify
(
data
));
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormOnState_commonEvent"
);
expect
(
data
.
data
)
.
assertEqual
(
"0"
);
commonEvent
.
unsubscribe
(
subscriberOnState
,
()
=>
unsubscribeOnStateCallback
(
"FMS_notifyInvisibleForms_1100"
));
formIdVisible
=
data
.
parameters
.
formId
;
subscriberOnState
=
await
commonEvent
.
createSubscriber
(
onStateFormEvent
);
commonEvent
.
subscribe
(
subscriberOnState
,
OnInvisibleCallBack
);
console
.
log
(
`FMS_notifyInvisibleForms_1100 featureAbility.startAbility again start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostg"
,
abilityName
:
"com.ohos.st.formsystemhostg.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestserviced.hmservice"
,
"ability"
:
"com.form.formsystemtestserviced.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"stateForm"
:
"invisible"
,
"stateIds"
:
[
formIdVisible
],
"isCreate"
:
false
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_1100 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_1100 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
expect
()
.
assertFail
();
done
();
});
console
.
log
(
`FMS_notifyInvisibleForms_1100 featureAbility.startAbility again end`
);
}
commonEvent
.
subscribe
(
subscriberOnState
,
onVisibleCallBack
);
commonEvent
.
subscribe
(
subscriberSupply
,
onSupplyCallBack
);
console
.
log
(
`FMS_notifyInvisibleForms_1100 featureAbility.startAbility start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostg"
,
abilityName
:
"com.ohos.st.formsystemhostg.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestserviced.hmservice"
,
"ability"
:
"com.form.formsystemtestserviced.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"stateForm"
:
"visible"
,
"stateIds"
:
[
"self"
],
"isCreate"
:
true
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_1100 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_1100 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
expect
()
.
assertFail
();
done
();
});
console
.
log
(
`FMS_notifyInvisibleForms_1100 featureAbility.startAbility end`
);
});
/**
* @tc.number: FMS_notifyInvisibleForms_1200
* @tc.name: When formVisibleNotify in config.json is true,
* the provider can be notified of the visibility of the form.
* @tc.desc: 1. The form is created successfully.
* 2. The invisible interface is invoked successfully,
* and the visibility notification of form providers A and B is triggered.
* The formId is the same as the created formId, and the visibility status is invisible.
*/
it
(
`FMS_notifyInvisibleForms_1200`
,
0
,
async
(
done
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_1200 start`
);
let
formId1
;
let
formId2
;
let
delCount
=
0
;
let
onSupplyCount
=
0
;
function
delPublishCallBack
()
{
console
.
info
(
"!!!====>FMS_notifyInvisibleForms_1200 delPublishCallBack====>"
);
delCount
++
;
if
(
delCount
==
2
)
{
setTimeout
(
function
()
{
console
.
info
(
'FMS_notifyInvisibleForms_1200 delPublishCallBack end'
);
console
.
info
(
'FMS_notifyInvisibleForms_1200 end'
);
done
();
},
500
);
}
}
function
onAcquiredCallBack_Normal1
(
_
,
data
)
{
console
.
info
(
"!!!====>FMS_notifyInvisibleForms_1200 onAcquiredCallBack_Normal1 data:====>"
+
JSON
.
stringify
(
data
));
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormOnAcquired_commonEvent"
);
commonEvent
.
unsubscribe
(
subscriberOnAcquired
,
unSubscribeOnAcquiredCallBack_Normal1
)
formId1
=
data
.
data
;
FMS_notifyInvisibleForms_1200_normal2
();
}
function
unSubscribeOnAcquiredCallBack_Normal1
()
{
console
.
debug
(
"====>FMS_notifyInvisibleForms_1200 unSubscribeOnAcquiredCallBack_Normal1 CallBack====>"
);
}
async
function
FMS_notifyInvisibleForms_1200_normal1
()
{
console
.
log
(
`FMS_notifyInvisibleForms_1200_normal1 start`
);
commonEvent
.
subscribe
(
subscriberOnAcquired
,
onAcquiredCallBack_Normal1
);
console
.
log
(
`FMS_notifyInvisibleForms_1200_normal1 featureAbility.startAbility start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostg"
,
abilityName
:
"com.ohos.st.formsystemhostg.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestservicea.hmservice"
,
"ability"
:
"com.form.formsystemtestservicea.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"isCreate"
:
true
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_1200_normal1 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_1200_normal1 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
expect
()
.
assertFail
();
done
();
});
console
.
log
(
`FMS_notifyInvisibleForms_1200_normal1 featureAbility.startAbility end`
);
console
.
log
(
`FMS_notifyInvisibleForms_1200_normal1 end`
);
}
function
onStateCallBack
(
_
,
data
)
{
console
.
info
(
"!!!====>FMS_notifyInvisibleForms_1200 onStateCallBack data:====>"
+
JSON
.
stringify
(
data
));
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormOnState_commonEvent"
);
expect
(
data
.
data
)
.
assertEqual
(
"0"
);
commonEvent
.
unsubscribe
(
subscriberOnState
,
()
=>
unsubscribeOnStateCallback
(
"FMS_notifyInvisibleForms_1200"
))
console
.
info
(
"!!!====>FMS_notifyInvisibleForms_1200 onStateCallBack formId1:====>"
+
formId1
);
console
.
info
(
"!!!====>FMS_notifyInvisibleForms_1200 onStateCallBack formId2:====>"
+
formId2
);
console
.
info
(
"!!!====>FMS_notifyInvisibleForms_1200 onStateCallBack onSupplyCount:====>"
+
onSupplyCount
);
if
(
formId1
&&
formId2
&&
onSupplyCount
==
2
)
{
let
commonEventPublishData
=
{
data
:
formId1
};
commonEvent
.
publish
(
deleteForm_Event
,
commonEventPublishData
,
delPublishCallBack
);
let
commonEventPublishData2
=
{
data
:
formId2
};
commonEvent
.
publish
(
deleteForm_Event
,
commonEventPublishData2
,
delPublishCallBack
);
}
}
async
function
onAcquiredCallBack_Normal2
(
_
,
data
)
{
console
.
info
(
"!!!====>FMS_notifyInvisibleForms_1200 onAcquiredCallBack_Normal2 data:====>"
+
JSON
.
stringify
(
data
));
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormOnAcquired_commonEvent"
);
commonEvent
.
unsubscribe
(
subscriberOnAcquired
,
unSubscribeOnAcquiredCallBack_Normal2
);
formId2
=
data
.
data
;
commonEvent
.
subscribe
(
subscriberOnState
,
onStateCallBack
);
console
.
log
(
`FMS_notifyInvisibleForms_1200 featureAbility.startAbility start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostg"
,
abilityName
:
"com.ohos.st.formsystemhostg.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestservicea.hmservice"
,
"ability"
:
"com.form.formsystemtestservicea.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"stateForm"
:
"invisible"
,
"stateIds"
:
[
formId1
,
formId2
],
"isCreate"
:
true
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_1200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_1200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
});
console
.
log
(
`FMS_notifyInvisibleForms_1200 featureAbility.startAbility end`
);
}
function
unSubscribeOnAcquiredCallBack_Normal2
()
{
console
.
debug
(
"====>FMS_notifyInvisibleForms_1200 unSubscribeOnAcquiredCallBack_Normal2====>"
);
}
async
function
FMS_notifyInvisibleForms_1200_normal2
()
{
subscriberOnAcquired
=
await
commonEvent
.
createSubscriber
(
onAcquiredForm_Event
);
commonEvent
.
subscribe
(
subscriberOnAcquired
,
onAcquiredCallBack_Normal2
);
console
.
log
(
`FMS_notifyInvisibleForms_1200_normal2 featureAbility.startAbility start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostg"
,
abilityName
:
"com.ohos.st.formsystemhostg.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestserviceb.hmservice"
,
"ability"
:
"com.form.formsystemtestserviceb.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"isCreate"
:
true
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_1200_normal2 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_1200_normal2 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
expect
()
.
assertFail
();
done
();
});
console
.
log
(
`FMS_notifyInvisibleForms_1200_normal2 featureAbility.startAbility end`
);
}
function
onSupplyCallBack
(
_
,
data
)
{
if
(
data
.
parameters
.
kind
==
"onVisibilityChange"
)
{
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormSupply_commonEvent"
);
console
.
debug
(
"====>FMS_notifyInvisibleForms_1200 onSupplyCallBack====>"
+
JSON
.
stringify
(
data
));
let
parameters
=
JSON
.
parse
(
data
.
parameters
.
parameters
);
if
(
parameters
[
formId1
])
{
expect
(
parameters
[
formId1
])
.
assertEqual
(
2
);
}
if
(
parameters
[
formId2
])
{
expect
(
parameters
[
formId2
])
.
assertEqual
(
2
);
}
onSupplyCount
++
;
if
(
onSupplyCount
==
2
)
{
commonEvent
.
unsubscribe
(
subscriberSupply
,
()
=>
unsubscribeSupplyCallback
(
"FMS_notifyInvisibleForms_1200"
));
}
if
(
formId1
&&
formId2
)
{
let
commonEventPublishData
=
{
data
:
formId1
};
commonEvent
.
publish
(
deleteForm_Event
,
commonEventPublishData
,
delPublishCallBack
);
let
commonEventPublishData2
=
{
data
:
formId2
};
commonEvent
.
publish
(
deleteForm_Event
,
commonEventPublishData2
,
delPublishCallBack
);
}
}
}
commonEvent
.
subscribe
(
subscriberSupply
,
onSupplyCallBack
);
FMS_notifyInvisibleForms_1200_normal1
();
});
/**
* @tc.number: FMS_notifyInvisibleForms_1300
* @tc.name: When formVisibleNotify is true in config.json,
* the form provider will be pulled when the card is invisible.
* @tc.desc: 1.The form user calls the invisible notification interface.
* 2.Verify the result of the invisible notification interface.
*/
it
(
`FMS_notifyInvisibleForms_1300`
,
0
,
async
(
done
)
=>
{
console
.
info
(
`FMS_notifyInvisibleForms_1300 start`
);
let
hostFormId
;
let
providerFormId
;
let
counter
=
0
;
const
delPublishCallback
=
(
_
,
data
)
=>
{
console
.
info
(
"!!!====>FMS_notifyInvisibleForms_1300 delPublishCallback====>"
);
setTimeout
(()
=>
{
expect
(
hostFormId
)
.
assertEqual
(
providerFormId
);
console
.
info
(
'FMS_notifyInvisibleForms_1300 delPublishCallback end'
);
console
.
info
(
`FMS_notifyInvisibleForms_1300 end`
);
done
();
},
1000
);
}
const
onSupplyCallback
=
(
_
,
data
)
=>
{
if
(
data
.
parameters
.
kind
!=
"onVisibilityChange"
)
{
return
;
}
console
.
debug
(
"====>FMS_notifyInvisibleForms_1300 onSupplyCallback data:====>"
+
JSON
.
stringify
(
data
));
providerFormId
=
Object
.
keys
(
JSON
.
parse
(
data
.
parameters
.
parameters
))[
0
];
const
visibilityStatus
=
JSON
.
parse
(
data
.
parameters
.
parameters
)[
providerFormId
];
expect
(
visibilityStatus
)
.
assertEqual
(
2
);
commonEvent
.
unsubscribe
(
subscriberSupply
,
()
=>
{
console
.
info
(
"====>FMS_notifyInvisibleForms_1300 unSubscribeSupplyCallback====>"
);
});
if
(
++
counter
==
2
)
{
const
commonEventPublishData
=
{
data
:
providerFormId
};
commonEvent
.
publish
(
deleteForm_Event
,
commonEventPublishData
,
delPublishCallback
);
}
}
const
onInvisibleCallback
=
(
_
,
data
)
=>
{
if
(
data
.
parameters
.
kind
!=
"invisible"
)
{
return
;
}
console
.
debug
(
"====>FMS_notifyInvisibleForms_1300 onInvisibleCallback data:====>"
+
JSON
.
stringify
(
data
));
hostFormId
=
data
.
parameters
.
formId
;
expect
(
data
.
data
)
.
assertEqual
(
"0"
);
commonEvent
.
unsubscribe
(
subscriberOnState
,
()
=>
{
console
.
info
(
"====>FMS_notifyInvisibleForms_1300 unSubscribeOnInvisibleCallback====>"
);
});
if
(
++
counter
==
2
)
{
const
commonEventPublishData
=
{
data
:
hostFormId
};
commonEvent
.
publish
(
deleteForm_Event
,
commonEventPublishData
,
delPublishCallback
);
}
}
commonEvent
.
subscribe
(
subscriberOnState
,
onInvisibleCallback
);
commonEvent
.
subscribe
(
subscriberSupply
,
onSupplyCallback
);
console
.
info
(
`FMS_notifyInvisibleForms_1300 featureAbility.startAbility start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostg"
,
abilityName
:
"com.ohos.st.formsystemhostg.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestservicef.hmservice"
,
"ability"
:
"com.form.formsystemtestservicef.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"stateForm"
:
"invisible"
,
"stateIds"
:
[
"self"
],
"isCreate"
:
true
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
debug
(
`FMS_notifyInvisibleForms_1300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
debug
(
`FMS_notifyInvisibleForms_1300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
expect
()
.
assertFail
();
done
();
});
});
/**
* @tc.number: FMS_notifyInvisibleForms_1400
* @tc.name: Use -1 form Id and created 2 form card Id notify the form to be invisible.
* @tc.desc: 1.The form user calls the visible notification interface.
* 2.Verify the result of the visible notification interface.
*/
it
(
`FMS_notifyInvisibleForms_1400`
,
0
,
async
(
done
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_1400 start`
);
let
formIds
=
new
Array
();
let
count
=
0
;
function
delPublishCallBack1
(
_
,
data
)
{
console
.
info
(
"!!!====>FMS_notifyInvisibleForms_1400 delPublishCallBack1====>"
+
JSON
.
stringify
(
data
));
setTimeout
(
function
()
{
console
.
info
(
'FMS_notifyInvisibleForms_1400 delPublishCallBack1 end'
);
console
.
log
(
`FMS_notifyInvisibleForms_1400 end`
);
},
1000
);
}
function
delPublishCallBack2
(
_
,
data
)
{
console
.
info
(
"!!!====>FMS_notifyInvisibleForms_1400 delPublishCallBack2====>"
+
JSON
.
stringify
(
data
));
setTimeout
(
function
()
{
console
.
info
(
'FMS_notifyInvisibleForms_1400 delPublishCallBack2 end'
);
console
.
log
(
`FMS_notifyInvisibleForms_1400 end`
);
done
();
},
1000
);
}
function
onSupplyCallBack
(
_
,
data
)
{
if
(
data
.
parameters
.
kind
==
"onVisibilityChange"
)
{
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormSupply_commonEvent"
);
console
.
debug
(
"====>FMS_notifyInvisibleForms_1400 onSupplyCallBack====>"
+
JSON
.
stringify
(
data
));
let
retFormId
=
Object
.
keys
(
JSON
.
parse
(
data
.
parameters
.
parameters
))[
0
];
const
visibilityStatus
=
JSON
.
parse
(
data
.
parameters
.
parameters
)[
retFormId
];
expect
(
formIds
.
includes
(
retFormId
))
.
assertTrue
();
expect
(
visibilityStatus
)
.
assertEqual
(
2
);
++
count
;
if
(
count
==
2
)
{
console
.
debug
(
"====>FMS_notifyInvisibleForms_1400 OK====>"
);
commonEvent
.
unsubscribe
(
subscriberSupply
,
()
=>
unsubscribeSupplyCallback
(
"FMS_notifyInvisibleForms_1400"
));
let
commonEventPublishData1
=
{
data
:
formIds
[
0
]
};
commonEvent
.
publish
(
deleteForm_Event
,
commonEventPublishData1
,
delPublishCallBack1
);
let
commonEventPublishData2
=
{
data
:
formIds
[
1
]
};
commonEvent
.
publish
(
deleteForm_Event
,
commonEventPublishData2
,
delPublishCallBack2
);
}
}
}
async
function
onSecondAcquiredCallBack
(
_
,
data
)
{
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormOnAcquired_commonEvent"
);
commonEvent
.
unsubscribe
(
subscriberOnAcquired
,
()
=>
unsubscribeSupplyCallback
(
"FMS_notifyInvisibleForms_1400"
));
console
.
debug
(
"====>FMS_notifyInvisibleForms_1400 onSecondAcquiredCallBack====>"
+
JSON
.
stringify
(
data
));
formIds
.
push
(
data
.
data
);
formIds
.
push
(
"-1"
);
console
.
debug
(
"====>FMS_notifyInvisibleForms_1400 formIds====>"
+
formIds
);
commonEvent
.
subscribe
(
subscriberSupply
,
onSupplyCallBack
);
console
.
log
(
`FMS_notifyInvisibleForms_1400 featureAbility.startAbility notifyInVisible start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostg"
,
abilityName
:
"com.ohos.st.formsystemhostg.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"name"
,
"bundle"
:
"bundle"
,
"ability"
:
"ability"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"stateForm"
:
"invisible"
,
"stateIds"
:
formIds
,
"isCreate"
:
false
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_1400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_1400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
expect
()
.
assertFail
();
done
();
});
console
.
log
(
`FMS_notifyInvisibleForms_1400 featureAbility.startAbility notifyInVisible end`
);
}
async
function
onFirstAcquiredCallBack
(
_
,
data
)
{
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormOnAcquired_commonEvent"
);
commonEvent
.
unsubscribe
(
subscriberOnAcquired
,
()
=>
unsubscribeSupplyCallback
(
"FMS_notifyInvisibleForms_1400"
));
console
.
debug
(
"====>FMS_notifyInvisibleForms_1400 onFirstAcquiredCallBack====>"
+
JSON
.
stringify
(
data
));
formIds
.
push
(
data
.
data
);
subscriberOnAcquired
=
await
commonEvent
.
createSubscriber
(
onAcquiredForm_Event
);
commonEvent
.
subscribe
(
subscriberOnAcquired
,
onSecondAcquiredCallBack
);
console
.
log
(
`FMS_notifyInvisibleForms_1400 featureAbility.startAbility serviceb start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostg"
,
abilityName
:
"com.ohos.st.formsystemhostg.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestserviceb.hmservice"
,
"ability"
:
"com.form.formsystemtestserviceb.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"isCreate"
:
true
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_1400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_1400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
expect
()
.
assertFail
();
done
();
});
console
.
log
(
`FMS_notifyInvisibleForms_1400 featureAbility.startAbility serviceb end`
);
}
commonEvent
.
subscribe
(
subscriberOnAcquired
,
onFirstAcquiredCallBack
);
console
.
log
(
`FMS_notifyInvisibleForms_1400 featureAbility.startAbility servicea start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostg"
,
abilityName
:
"com.ohos.st.formsystemhostg.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestservicea.hmservice"
,
"ability"
:
"com.form.formsystemtestservicea.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"isCreate"
:
true
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_1400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_1400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
expect
()
.
assertFail
();
done
();
});
console
.
log
(
`FMS_notifyInvisibleForms_1400 featureAbility.startAbility servicea end`
);
});
/**
* @tc.number: FMS_notifyInvisibleForms_1500
* @tc.name: The size of invisible form ids in the notification form array exceeds 32.
* @tc.desc: 1. Failed to invoke the invisibility interface (parameter error).
*/
it
(
`FMS_notifyInvisibleForms_1500`
,
0
,
async
(
done
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_1500 start`
);
function
onStateCallBack
(
_
,
data
)
{
console
.
info
(
"!!!====>FMS_notifyInvisibleForms_1500 onStateCallBack data:====>"
+
JSON
.
stringify
(
data
));
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormOnState_commonEvent"
);
expect
(
data
.
data
)
.
assertEqual
(
"7"
);
commonEvent
.
unsubscribe
(
subscriberOnState
,
()
=>
unsubscribeOnStateCallback
(
"FMS_notifyInvisibleForms_1500"
))
setTimeout
(
function
()
{
console
.
info
(
'FMS_notifyInvisibleForms_1500 delPublishCallBack end'
);
console
.
log
(
`FMS_notifyInvisibleForms_1500 end`
);
done
();
},
100
)
}
commonEvent
.
subscribe
(
subscriberOnState
,
onStateCallBack
);
console
.
log
(
`FMS_notifyInvisibleForms_1500 featureAbility.startAbility start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostg"
,
abilityName
:
"com.ohos.st.formsystemhostg.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestservicea.hmservice"
,
"ability"
:
"com.form.formsystemtestservicea.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"stateForm"
:
"invisible"
,
"stateIds"
:
[
"1"
,
"2"
,
"3"
,
"4"
,
"5"
,
"6"
,
"7"
,
"8"
,
"9"
,
"10"
,
"11"
,
"12"
,
"13"
,
"14"
,
"15"
,
"16"
,
"17"
,
"18"
,
"19"
,
"20"
,
"21"
,
"22"
,
"23"
,
"24"
,
"25"
,
"26"
,
"27"
,
"28"
,
"29"
,
"30"
,
"31"
,
"32"
,
"33"
],
"isCreate"
:
false
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_1500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyInvisibleForms_1500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
expect
()
.
assertFail
();
done
();
});
console
.
log
(
`FMS_notifyInvisibleForms_1500 featureAbility.startAbility end`
);
});
});
}
const
sleep
=
async
delay
=>
{
return
new
Promise
((
resolve
,
_
)
=>
{
setTimeout
(
async
()
=>
{
resolve
(
0
);
},
delay
);
});
};
const
delPublishCallback
=
async
(
tcNumber
,
done
)
=>
{
console
.
info
(
`${tcNumber} delPublishCallBack start`
);
setTimeout
(
function
()
{
console
.
info
(
`${tcNumber} delPublishCallBack end`
);
done
();
},
1000
);
}
const
unsubscribeOnStateCallback
=
(
tcNumber
)
=>
{
console
.
debug
(
`====>${tcNumber} unsubscribeOnStateCallback====>`
);
}
const
unsubscribeSupplyCallback
=
(
tcNumber
)
=>
{
console
.
debug
(
`====>${tcNumber} unSubscribeSupplyCallback====>`
);
}
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/test/List.test.ets
已删除
100644 → 0
浏览文件 @
3413a1fd
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import test from './FmsFormStateNotifyInvisible2.test.ets';
export default function testsuite() {
test();
}
\ No newline at end of file
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/resources/base/element/string.json
已删除
100644 → 0
浏览文件 @
3413a1fd
{
"string"
:
[
{
"name"
:
"entry_MainAbility"
,
"value"
:
"forminvisiblestatetest"
},
{
"name"
:
"description_mainability"
,
"value"
:
"ETS_Empty Ability"
},
{
"name"
:
"TestAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"TestAbility_label"
,
"value"
:
"label"
}
]
}
\ No newline at end of file
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/resources/base/media/icon.png
已删除
100644 → 0
浏览文件 @
3413a1fd
6.6 KB
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/signature/openharmony_sx.p7b
已删除
100644 → 0
浏览文件 @
3413a1fd
文件已删除
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/BUILD.gn
已删除
100644 → 0
浏览文件 @
3413a1fd
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsFormStateNotifyVisibleTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_js_test_assets",
":hjs_demo_resources",
]
ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsFormStateNotifyVisibleTest"
subsystem_name = "ability"
part_name = "form_fwk"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/ets/MainAbility"
}
ohos_js_assets("hjs_demo_js_test_assets") {
source_dir = "./entry/src/main/ets/TestAbility"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json"
}
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/Test.json
已删除
100644 → 0
浏览文件 @
3413a1fd
{
"description"
:
"Configuration for hjunit demo Tests"
,
"driver"
:
{
"type"
:
"OHJSUnitTest"
,
"test-timeout"
:
"300000"
,
"bundle-name"
:
"com.ohos.st.formstatenotifyvisibletest"
,
"package-name"
:
"com.ohos.st.formstatenotifyvisibletest"
,
"shell-timeout"
:
"600000"
,
"testcase-timeout"
:
"30000"
},
"kits"
:
[
{
"test-file-name"
:
[
"ActsFormStateNotifyVisibleTest.hap"
,
"FormSystemHostF.hap"
,
"FormSystemHostG.hap"
,
"FormSystemHostNoPerm.hap"
,
"FormSupplyAppA.hap"
,
"FormSupplyAppB.hap"
,
"FormSupplyAppD.hap"
,
"FormSupplyAppE.hap"
,
"FormSupplyAppF.hap"
,
"FormSupplyAppG.hap"
,
"FormSupplyAppH.hap"
,
"FormSupplyAppNS.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
}
]
}
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/config.json
已删除
100644 → 0
浏览文件 @
3413a1fd
{
"app"
:
{
"bundleName"
:
"com.ohos.st.formstatenotifyvisibletest"
,
"vendor"
:
"ohos"
,
"version"
:
{
"code"
:
1000000
,
"name"
:
"1.0.0"
},
"apiVersion"
:
{
"compatible"
:
7
,
"releaseType"
:
"Release"
,
"target"
:
7
}
},
"deviceConfig"
:
{},
"module"
:
{
"package"
:
"com.ohos.st.formstatenotifyvisibletest"
,
"name"
:
".FormStateSTApp"
,
"mainAbility"
:
".MainAbility"
,
"deviceType"
:
[
"default"
,
"tablet"
],
"distro"
:
{
"deliveryWithInstall"
:
true
,
"moduleName"
:
"entry"
,
"moduleType"
:
"entry"
,
"installationFree"
:
false
},
"abilities"
:
[
{
"skills"
:
[
{
"entities"
:
[
"entity.system.home"
],
"actions"
:
[
"action.system.home"
]
}
],
"visible"
:
true
,
"name"
:
".MainAbility"
,
"srcPath"
:
"MainAbility"
,
"srcLanguage"
:
"ets"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:description_mainability"
,
"label"
:
"$string:entry_MainAbility"
,
"type"
:
"page"
,
"launchType"
:
"standard"
},
{
"orientation"
:
"unspecified"
,
"formsEnabled"
:
false
,
"name"
:
".TestAbility"
,
"srcLanguage"
:
"ets"
,
"srcPath"
:
"TestAbility"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:TestAbility_desc"
,
"label"
:
"$string:TestAbility_label"
,
"type"
:
"page"
,
"visible"
:
true
,
"launchType"
:
"singleton"
}
],
"defPermissions"
:
[
{
"availableScope"
:
[],
"grantMode"
:
"system_grant"
,
"name"
:
"FMS_FormDelete_commonEvent"
},
{
"availableScope"
:
[],
"grantMode"
:
"system_grant"
,
"name"
:
"FMS_FormOnAcquired_commonEvent"
},
{
"availableScope"
:
[],
"grantMode"
:
"system_grant"
,
"name"
:
"FMS_FormOnError_commonEvent"
},
{
"availableScope"
:
[],
"grantMode"
:
"system_grant"
,
"name"
:
"FMS_FormOnDeleted_commonEvent"
},
{
"availableScope"
:
[],
"grantMode"
:
"system_grant"
,
"name"
:
"FMS_FormOnState_commonEvent"
},
{
"availableScope"
:
[],
"grantMode"
:
"system_grant"
,
"name"
:
"FMS_FormSupply_commonEvent"
}
],
"reqPermissions"
:
[
{
"name"
:
"FMS_FormOnAcquired_commonEvent"
,
"reason"
:
"need use onAcquired commonEvent"
},
{
"name"
:
"FMS_FormDelete_commonEvent"
,
"reason"
:
"need use delete commonEvent"
},
{
"name"
:
"FMS_FormOnError_commonEvent"
,
"reason"
:
"need use OnError commonEvent"
},
{
"name"
:
"FMS_FormOnDeleted_commonEvent"
,
"reason"
:
"need use OnDeleted commonEvent"
},
{
"name"
:
"FMS_FormOnState_commonEvent"
,
"reason"
:
"need use OnState commonEvent"
},
{
"name"
:
"FMS_FormSupply_commonEvent"
,
"reason"
:
"need use FormSupply commonEvent"
},
{
"name"
:
"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
,
"reason"
:
"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
},
{
"name"
:
"ohos.permission.CLEAN_BACKGROUND_PROCESSES"
,
"reason"
:
"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES"
},
{
"name"
:
"ohos.permission.START_ABILITIES_FROM_BACKGROUND"
,
"reason"
:
"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND"
}
],
"js"
:
[
{
"mode"
:
{
"syntax"
:
"ets"
,
"type"
:
"pageAbility"
},
"pages"
:
[
"pages/index"
],
"name"
:
".MainAbility"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
},
{
"mode"
:
{
"syntax"
:
"ets"
,
"type"
:
"pageAbility"
},
"pages"
:
[
"pages/index"
],
"name"
:
".TestAbility"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
}
]
}
}
\ No newline at end of file
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/MainAbility/app.ets
已删除
100644 → 0
浏览文件 @
3413a1fd
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('[FormComponent] Application onCreate')
},
onDestroy() {
console.info('[FormComponent] Application onDestroy')
},
}
\ No newline at end of file
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/MainAbility/pages/index.ets
已删除
100644 → 0
浏览文件 @
3413a1fd
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
build() {
Flex({
direction: FlexDirection.Column,
alignItems: ItemAlign.Center,
justifyContent: FlexAlign.Center
}) {
Text('Fms Main Ability Test')
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
.height('100%')
}
}
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/TestAbility/app.ets
已删除
100644 → 0
浏览文件 @
3413a1fd
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
export default {
onCreate() {
console.info('Application onCreate')
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
},
onDestroy() {
console.info('Application onDestroy')
},
}
\ No newline at end of file
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/TestAbility/pages/index.ets
已删除
100644 → 0
浏览文件 @
3413a1fd
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import router from '@system.router';
@Entry
@Component
struct Index {
aboutToAppear() {
console.info('TestAbility index aboutToAppear')
}
@State message: string = 'Hello World'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('next page')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.width('35%')
.height('5%')
.onClick(()=>{
})
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
已删除
100644 → 0
浏览文件 @
3413a1fd
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
TestRunner
from
'
@ohos.application.testRunner
'
import
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
var
abilityDelegator
=
undefined
var
abilityDelegatorArguments
=
undefined
function
translateParamsToString
(
parameters
)
{
const
keySet
=
new
Set
([
'
-s class
'
,
'
-s notClass
'
,
'
-s suite
'
,
'
-s itName
'
,
'
-s level
'
,
'
-s testType
'
,
'
-s size
'
,
'
-s timeout
'
,
'
-s package
'
])
let
targetParams
=
''
;
for
(
const
key
in
parameters
)
{
if
(
keySet
.
has
(
key
))
{
targetParams
+=
'
'
+
key
+
'
'
+
parameters
[
key
]
}
}
return
targetParams
.
trim
()
}
async
function
onAbilityCreateCallback
()
{
console
.
log
(
'
onAbilityCreateCallback
'
);
}
async
function
addAbilityMonitorCallback
(
err
:
any
)
{
console
.
info
(
'
addAbilityMonitorCallback :
'
+
JSON
.
stringify
(
err
))
}
export
default
class
OpenHarmonyTestRunner
implements
TestRunner
{
constructor
()
{
}
onPrepare
()
{
console
.
info
(
'
OpenHarmonyTestRunner OnPrepare
'
)
}
onRun
()
{
console
.
log
(
'
OpenHarmonyTestRunner onRun run
'
)
abilityDelegatorArguments
=
AbilityDelegatorRegistry
.
getArguments
()
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
()
let
lMonitor
=
{
abilityName
:
testAbilityName
,
onAbilityCreate
:
onAbilityCreateCallback
,
};
var
testAbilityName
=
abilityDelegatorArguments
.
parameters
[
'
-p
'
]
+
'
.TestAbility
'
abilityDelegator
.
addAbilityMonitor
(
lMonitor
,
addAbilityMonitorCallback
)
var
cmd
=
'
aa start -d 0 -a
'
+
testAbilityName
+
'
-b
'
+
abilityDelegatorArguments
.
bundleName
cmd
+=
'
'
+
translateParamsToString
(
abilityDelegatorArguments
.
parameters
)
console
.
info
(
'
cmd :
'
+
cmd
)
abilityDelegator
.
executeShellCommand
(
cmd
,
(
err
:
any
,
d
:
any
)
=>
{
console
.
info
(
'
executeShellCommand : err :
'
+
JSON
.
stringify
(
err
));
console
.
info
(
'
executeShellCommand : data :
'
+
d
.
stdResult
);
console
.
info
(
'
executeShellCommand : data :
'
+
d
.
exitCode
);
})
console
.
info
(
'
OpenHarmonyTestRunner onRun call abilityDelegator.getAppContext
'
)
var
context
=
abilityDelegator
.
getAppContext
()
console
.
info
(
'
getAppContext :
'
+
JSON
.
stringify
(
context
))
console
.
info
(
'
OpenHarmonyTestRunner onRun end
'
)
}
};
\ No newline at end of file
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/test/FmsFormStateNotifyVisible.test.ets
已删除
100644 → 0
浏览文件 @
3413a1fd
/*
* 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
featureAbility
from
"@ohos.ability.featureAbility"
;
import
commonEvent
from
'@ohos.commonEvent'
;
import
{
beforeAll
,
beforeEach
,
afterEach
,
describe
,
expect
,
it
}
from
'@ohos/hypium'
var
onAcquiredForm_Event
=
{
events
:
[
"FMS_FormOnAcquired_commonEvent"
],
};
var
onStateFormEvent
=
{
events
:
[
"FMS_FormOnState_commonEvent"
],
};
var
onSupplyEvent
=
{
events
:
[
"FMS_FormSupply_commonEvent"
],
};
const
unsubscribeCallback
=
(
tcNumber
)
=>
{
console
.
info
(
`====>${tcNumber} unsubscribeCallback====>`
);
}
var
deleteForm_Event
=
"FMS_FormDelete_commonEvent"
;
var
subscriberOnAcquired
;
var
subscriberOnState
;
var
subscriberSupply
;
export
default
function
test
()
{
describe
(
`FmsStateFormTest`
,
()
=>
{
beforeAll
(
async
(
done
)
=>
{
done
();
})
beforeEach
(
async
()
=>
{
subscriberOnAcquired
=
await
commonEvent
.
createSubscriber
(
onAcquiredForm_Event
);
subscriberOnState
=
await
commonEvent
.
createSubscriber
(
onStateFormEvent
);
subscriberSupply
=
await
commonEvent
.
createSubscriber
(
onSupplyEvent
);
await
sleep
(
1000
);
})
afterEach
(
async
()
=>
{
commonEvent
.
unsubscribe
(
subscriberOnAcquired
,
()
=>
unsubscribeCallback
(
"afterEach unsubscribe subscriberOnAcquired"
));
commonEvent
.
unsubscribe
(
subscriberOnState
,
()
=>
unsubscribeCallback
(
"afterEach unsubscribe subscriberOnState"
));
commonEvent
.
unsubscribe
(
subscriberSupply
,
()
=>
unsubscribeCallback
(
"afterEach unsubscribe subscriberSupply"
));
let
wantInfo
=
{
want
:
{
bundleName
:
"com.ohos.st.formstatenotifyvisibletest"
,
abilityName
:
"com.ohos.st.formstatenotifyvisibletest.TestAbility"
}
}
await
featureAbility
.
startAbility
(
wantInfo
)
.
then
((
data
)
=>
{
console
.
log
(
"FMS_notifyVisibleForms startAbility data : "
+
JSON
.
stringify
(
data
));
})
.
catch
((
err
)
=>
{
console
.
log
(
"FMS_notifyVisibleForms startAbility err : "
+
JSON
.
stringify
(
err
));
})
await
sleep
(
1000
);
})
/**
* @tc.number: FMS_notifyVisibleForms_0200
* @tc.name: The form user does not have permission.
* @tc.desc: 1.The form user calls the visible notification interface.
* 2.Verify the result of the visible notification interface.
*/
it
(
`FMS_notifyVisibleForms_0200`
,
0
,
async
(
done
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_0200 start`
);
function
onStateCallBack
(
_
,
data
)
{
console
.
info
(
"!!!====>FMS_notifyVisibleForms_0200 onStateCallBack data:====>"
+
JSON
.
stringify
(
data
));
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormOnState_commonEvent"
);
expect
(
data
.
data
)
.
assertEqual
(
"2"
);
commonEvent
.
unsubscribe
(
subscriberOnState
,
()
=>
unsubscribeOnStateCallback
(
"FMS_notifyVisibleForms_0200"
));
setTimeout
(
function
()
{
console
.
info
(
'FMS_notifyVisibleForms_0200 onStateCallBack end'
);
console
.
log
(
`FMS_notifyVisibleForms_0200 end`
);
done
();
},
1000
)
}
commonEvent
.
subscribe
(
subscriberOnState
,
onStateCallBack
);
console
.
log
(
`FMS_notifyVisibleForms_0200 featureAbility.startAbility again start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostnoperm"
,
abilityName
:
"com.ohos.st.formsystemhostnoperm.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestservicea.hmservice"
,
"ability"
:
"com.form.formsystemtestservicea.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"stateForm"
:
"visible"
,
"stateIds"
:
[
"1"
],
"isCreate"
:
false
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_0200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_0200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
});
console
.
log
(
`FMS_notifyVisibleForms_0200 featureAbility.startAbility again end`
);
});
/**
* @tc.number: FMS_notifyVisibleForms_0300
* @tc.name: The length of the formId list is 0 (no formId)
* @tc.desc: 1.The form user calls the visible notification interface.
* 2.Verify the result of the visible notification interface.
*/
it
(
`FMS_notifyVisibleForms_0300`
,
0
,
async
(
done
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_0300 start`
);
function
onStateCallBack
(
_
,
data
)
{
console
.
info
(
"!!!====>FMS_notifyVisibleForms_0300 onStateCallBack data:====>"
+
JSON
.
stringify
(
data
));
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormOnState_commonEvent"
);
expect
(
data
.
data
)
.
assertEqual
(
"7"
);
commonEvent
.
unsubscribe
(
subscriberOnState
,
()
=>
unsubscribeOnStateCallback
(
"FMS_notifyVisibleForms_0300"
));
setTimeout
(
function
()
{
console
.
info
(
'FMS_notifyVisibleForms_0300 delPublishCallBack end'
);
console
.
log
(
`FMS_notifyVisibleForms_0300 end`
);
done
();
},
100
)
}
commonEvent
.
subscribe
(
subscriberOnState
,
onStateCallBack
);
console
.
log
(
`FMS_notifyVisibleForms_0300 featureAbility.startAbility start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostg"
,
abilityName
:
"com.ohos.st.formsystemhostg.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestservicea.hmservice"
,
"ability"
:
"com.form.formsystemtestservicea.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"stateForm"
:
"visible"
,
"stateIds"
:
[],
"isCreate"
:
false
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_0300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_0300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
});
console
.
log
(
`FMS_notifyVisibleForms_0300 featureAbility.startAbility end`
);
});
/**
* @tc.number: FMS_notifyVisibleForms_0400
* @tc.name: formID id is error(formID < 0)
* @tc.desc: 1.The form user calls the visible notification interface.
* 2.Verify the result of the visible notification interface.
*/
it
(
`FMS_notifyVisibleForms_0400`
,
0
,
async
(
done
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_0400 start`
);
function
onStateCallBack
(
_
,
data
)
{
console
.
info
(
"!!!====>FMS_notifyVisibleForms_0400 onStateCallBack data:====>"
+
JSON
.
stringify
(
data
));
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormOnState_commonEvent"
);
expect
(
data
.
data
)
.
assertEqual
(
"0"
);
commonEvent
.
unsubscribe
(
subscriberOnState
,
()
=>
unsubscribeOnStateCallback
(
"FMS_notifyVisibleForms_0400"
))
setTimeout
(
function
()
{
console
.
info
(
'FMS_notifyVisibleForms_0400 delPublishCallBack end'
);
console
.
log
(
`FMS_notifyVisibleForms_0400 end`
);
done
();
},
100
)
}
commonEvent
.
subscribe
(
subscriberOnState
,
onStateCallBack
);
console
.
log
(
`FMS_notifyVisibleForms_0400 featureAbility.startAbility start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostg"
,
abilityName
:
"com.ohos.st.formsystemhostg.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestservicea.hmservice"
,
"ability"
:
"com.form.formsystemtestservicea.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"stateForm"
:
"visible"
,
"stateIds"
:
[
"-1"
],
"isCreate"
:
false
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_0400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_0400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
});
console
.
log
(
`FMS_notifyVisibleForms_0400 featureAbility.startAbility end`
);
});
/**
* @tc.number: FMS_notifyVisibleForms_0500
* @tc.name: formID id is error(formID == 0)
* @tc.desc: 1.The form user calls the visible notification interface.
* 2.Verify the result of the visible notification interface.
*/
it
(
`FMS_notifyVisibleForms_0500`
,
0
,
async
(
done
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_0500 start`
);
function
onStateCallBack
(
_
,
data
)
{
console
.
info
(
"!!!====>FMS_notifyVisibleForms_0500 onStateCallBack data:====>"
+
JSON
.
stringify
(
data
));
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormOnState_commonEvent"
);
expect
(
data
.
data
)
.
assertEqual
(
"0"
);
commonEvent
.
unsubscribe
(
subscriberOnState
,
()
=>
unsubscribeOnStateCallback
(
"FMS_notifyVisibleForms_0500"
))
setTimeout
(
function
()
{
console
.
info
(
'FMS_notifyVisibleForms_0500 delPublishCallBack end'
);
console
.
log
(
`FMS_notifyVisibleForms_0500 end`
);
done
();
},
100
);
}
commonEvent
.
subscribe
(
subscriberOnState
,
onStateCallBack
);
console
.
log
(
`FMS_notifyVisibleForms_0500 featureAbility.startAbility start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostg"
,
abilityName
:
"com.ohos.st.formsystemhostg.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestservicea.hmservice"
,
"ability"
:
"com.form.formsystemtestservicea.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"stateForm"
:
"visible"
,
"stateIds"
:
[
"0"
],
"isCreate"
:
false
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_0500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_0500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
});
console
.
log
(
`FMS_notifyVisibleForms_0500 featureAbility.startAbility end`
);
});
/**
* @tc.number: FMS_notifyVisibleForms_0600
* @tc.name: formID id is error because formId is not self
* @tc.desc: 1.The form user calls the visible notification interface.
* 2.Verify the result of the visible notification interface.
*/
it
(
`FMS_notifyVisibleForms_0600`
,
0
,
async
(
done
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_0600 start`
);
let
formId
;
function
onStateCallBack
(
_
,
data
)
{
console
.
info
(
"!!!====>FMS_notifyVisibleForms_0600 onStateCallBack data:====>"
+
JSON
.
stringify
(
data
));
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormOnState_commonEvent"
);
expect
(
data
.
data
)
.
assertEqual
(
"0"
);
commonEvent
.
unsubscribe
(
subscriberOnState
,
()
=>
unsubscribeOnStateCallback
(
"FMS_notifyVisibleForms_0600"
));
let
commonEventPublishData
=
{
data
:
formId
};
commonEvent
.
publish
(
deleteForm_Event
,
commonEventPublishData
,
()
=>
delPublishCallback
(
"FMS_notifyVisibleForms_0600"
,
done
));
}
async
function
onAcquiredCallBack
(
_
,
data
)
{
console
.
info
(
"!!!====>FMS_notifyVisibleForms_0600 onAcquiredCallBack data:====>"
+
JSON
.
stringify
(
data
));
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormOnAcquired_commonEvent"
);
commonEvent
.
unsubscribe
(
subscriberOnAcquired
,
()
=>
unsubscribeOnAcquiredCallback
(
"FMS_notifyVisibleForms_0600"
))
formId
=
data
.
data
;
commonEvent
.
subscribe
(
subscriberOnState
,
onStateCallBack
);
console
.
log
(
`FMS_notifyVisibleForms_0600 featureAbility.startAbility again start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostg"
,
abilityName
:
"com.ohos.st.formsystemhostg.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestservicea.hmservice"
,
"ability"
:
"com.form.formsystemtestservicea.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"stateForm"
:
"visible"
,
"stateIds"
:
[
formId
],
"isCreate"
:
false
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_0600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_0600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
});
console
.
log
(
`FMS_notifyVisibleForms_0600 featureAbility.startAbility again end`
);
}
commonEvent
.
subscribe
(
subscriberOnAcquired
,
onAcquiredCallBack
);
console
.
log
(
`FMS_notifyVisibleForms_0600 featureAbility.startAbility start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostf"
,
abilityName
:
"com.ohos.st.formsystemhostf.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestservicea.hmservice"
,
"ability"
:
"com.form.formsystemtestservicea.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"isCreate"
:
true
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_0600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_0600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
});
console
.
log
(
`FMS_notifyVisibleForms_0600 featureAbility.startAbility end`
);
});
/**
* @tc.number: FMS_notifyVisibleForms_0700
* @tc.name: Form ID error (FormID does not exist)
* @tc.desc: 1.The form user calls the visible notification interface.
* 2.Verify the result of the visible notification interface.
*/
it
(
`FMS_notifyVisibleForms_0700`
,
0
,
async
(
done
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_0700 start`
);
function
onStateCallBack
(
_
,
data
)
{
console
.
info
(
"!!!====>FMS_notifyVisibleForms_0700 onStateCallBack data:====>"
+
JSON
.
stringify
(
data
));
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormOnState_commonEvent"
);
expect
(
data
.
data
)
.
assertEqual
(
"0"
);
commonEvent
.
unsubscribe
(
subscriberOnState
,
()
=>
unsubscribeOnStateCallback
(
"FMS_notifyVisibleForms_0700"
));
setTimeout
(
function
()
{
console
.
info
(
'FMS_notifyVisibleForms_0700 onStateCallBack end'
);
console
.
log
(
`FMS_notifyVisibleForms_0700 end`
);
done
();
},
100
);
}
commonEvent
.
subscribe
(
subscriberOnState
,
onStateCallBack
);
console
.
log
(
`FMS_notifyVisibleForms_0700 featureAbility.startAbility again start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostg"
,
abilityName
:
"com.ohos.st.formsystemhostg.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestservicea.hmservice"
,
"ability"
:
"com.form.formsystemtestservicea.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"stateForm"
:
"visible"
,
"stateIds"
:
[
"123456789"
],
"isCreate"
:
false
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_0700 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_0700 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
});
console
.
log
(
`FMS_notifyVisibleForms_0700 featureAbility.startAbility again end`
);
});
/**
* @tc.number: FMS_notifyVisibleForms_1000
* @tc.name: The form provider is the system application and config When form visiblenotify is true,
* the form provider can be notified that the form is visible.
* @tc.desc: 1.The form user calls the visible notification interface.
* 2.Verify the result of the visible notification interface.
*/
it
(
`FMS_notifyVisibleForms_1000`
,
0
,
async
(
done
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_1000 start`
);
let
formIdInvisible
;
let
formIdVisible
;
let
onSupplyCount
=
0
;
function
onSupplyCallBack
(
_
,
data
)
{
if
(
data
.
parameters
.
kind
==
"onVisibilityChange"
)
{
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormSupply_commonEvent"
);
console
.
debug
(
"====>FMS_notifyVisibleForms_1000 onSupplyCallBack====>"
+
JSON
.
stringify
(
data
));
onSupplyCount
++
;
if
(
onSupplyCount
==
2
)
{
commonEvent
.
unsubscribe
(
subscriberSupply
,
()
=>
unsubscribeSupplyCallback
(
"FMS_notifyVisibleForms_1000"
));
}
if
(
formIdInvisible
&&
formIdVisible
)
{
let
commonEventPublishData
=
{
data
:
formIdInvisible
};
commonEvent
.
publish
(
deleteForm_Event
,
commonEventPublishData
,
()
=>
delPublishCallback
(
"FMS_notifyVisibleForms_1000"
,
done
));
}
}
}
function
onVisibleCallBack
(
_
,
data
)
{
console
.
info
(
"!!!====>FMS_notifyVisibleForms_1000 onVisibleCallBack data:====>"
+
JSON
.
stringify
(
data
));
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormOnState_commonEvent"
);
expect
(
data
.
data
)
.
assertEqual
(
"0"
);
formIdVisible
=
data
.
parameters
.
formId
;
commonEvent
.
unsubscribe
(
subscriberOnState
,
()
=>
unsubscribeOnStateCallback
(
"FMS_notifyVisibleForms_1000"
));
if
(
formIdInvisible
&&
formIdVisible
&&
onSupplyCount
==
2
)
{
let
commonEventPublishData
=
{
data
:
formIdInvisible
};
commonEvent
.
publish
(
deleteForm_Event
,
commonEventPublishData
,
()
=>
delPublishCallback
(
"FMS_notifyVisibleForms_1000"
,
done
));
}
}
async
function
OnInvisibleCallBack
(
_
,
data
)
{
console
.
info
(
"!!!====>FMS_notifyVisibleForms_1000 OnInvisibleCallBack data:====>"
+
JSON
.
stringify
(
data
));
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormOnState_commonEvent"
);
expect
(
data
.
data
)
.
assertEqual
(
"0"
);
commonEvent
.
unsubscribe
(
subscriberOnState
,
()
=>
unsubscribeOnStateCallback
(
"FMS_notifyVisibleForms_1000"
))
formIdInvisible
=
data
.
parameters
.
formId
;
subscriberOnState
=
await
commonEvent
.
createSubscriber
(
onStateFormEvent
);
commonEvent
.
subscribe
(
subscriberOnState
,
onVisibleCallBack
);
console
.
log
(
`FMS_notifyVisibleForms_1000 featureAbility.startAbility again start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostg"
,
abilityName
:
"com.ohos.st.formsystemhostg.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestservicea.hmservice"
,
"ability"
:
"com.form.formsystemtestservicea.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"stateForm"
:
"visible"
,
"stateIds"
:
[
formIdInvisible
],
"isCreate"
:
false
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_1000 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_1000 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
});
console
.
log
(
`FMS_notifyVisibleForms_1000 featureAbility.startAbility again end`
);
}
commonEvent
.
subscribe
(
subscriberOnState
,
OnInvisibleCallBack
);
commonEvent
.
subscribe
(
subscriberSupply
,
onSupplyCallBack
);
console
.
log
(
`FMS_notifyVisibleForms_1000 featureAbility.startAbility start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostg"
,
abilityName
:
"com.ohos.st.formsystemhostg.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestservicea.hmservice"
,
"ability"
:
"com.form.formsystemtestservicea.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"stateForm"
:
"invisible"
,
"stateIds"
:
[
"self"
],
"isCreate"
:
true
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_1000 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_1000 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
});
console
.
log
(
`FMS_notifyVisibleForms_1000 featureAbility.startAbility end`
);
});
/**
* @tc.number: FMS_notifyVisibleForms_1100
* @tc.name: Use 0 and created form card Id notify the form to be visible.
* @tc.desc: 1.The form user calls the visible notification interface.
* 2.Verify the result of the visible notification interface.
*/
it
(
`FMS_notifyVisibleForms_1100`
,
0
,
async
(
done
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_1100 start`
);
let
assertFormId
;
function
onSupplyCallBack
(
_
,
data
)
{
if
(
data
.
parameters
.
kind
==
"onVisibilityChange"
)
{
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormSupply_commonEvent"
);
commonEvent
.
unsubscribe
(
subscriberSupply
,
()
=>
unsubscribeSupplyCallback
(
"FMS_notifyVisibleForms_1100"
));
console
.
debug
(
"====>FMS_notifyVisibleForms_1100 onSupplyCallBack====>"
+
JSON
.
stringify
(
data
));
let
formId
=
Object
.
keys
(
JSON
.
parse
(
data
.
parameters
.
parameters
))[
0
];
const
visibilityStatus
=
JSON
.
parse
(
data
.
parameters
.
parameters
)[
formId
];
expect
(
formId
)
.
assertEqual
(
assertFormId
);
expect
(
visibilityStatus
)
.
assertEqual
(
1
);
let
commonEventPublishData
=
{
data
:
formId
};
commonEvent
.
publish
(
deleteForm_Event
,
commonEventPublishData
,
()
=>
delPublishCallback
(
"FMS_notifyVisibleForms_1000"
,
done
));
}
}
function
onVisibleCallBack
(
_
,
data
)
{
if
(
data
.
parameters
.
kind
!=
"visible"
)
{
return
;
}
console
.
info
(
"!!!====>FMS_notifyVisibleForms_1100 onVisibleCallBack data:====>"
+
JSON
.
stringify
(
data
));
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormOnState_commonEvent"
);
expect
(
data
.
data
)
.
assertEqual
(
"0"
);
assertFormId
=
data
.
parameters
.
formId
;
commonEvent
.
unsubscribe
(
subscriberOnState
,
()
=>
unsubscribeOnStateCallback
(
"FMS_notifyVisibleForms_1100"
));
}
commonEvent
.
subscribe
(
subscriberOnState
,
onVisibleCallBack
);
commonEvent
.
subscribe
(
subscriberSupply
,
onSupplyCallBack
);
console
.
log
(
`FMS_notifyVisibleForms_1100 featureAbility.startAbility start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostg"
,
abilityName
:
"com.ohos.st.formsystemhostg.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestservicea.hmservice"
,
"ability"
:
"com.form.formsystemtestservicea.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"stateForm"
:
"visible"
,
"stateIds"
:
[
"self"
,
"0"
],
"isCreate"
:
true
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_1100 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_1100 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
});
console
.
log
(
`FMS_notifyVisibleForms_1100 featureAbility.startAbility end`
);
});
/**
* @tc.number: FMS_notifyVisibleForms_1200
* @tc.name: When the form provider is not a system application, notify the form to be visible
* and do not pull up the form provider.
* @tc.desc: 1.The form user calls the visible notification interface.
* 2.Verify the result of the visible notification interface.
*/
it
(
`FMS_notifyVisibleForms_1200`
,
0
,
async
(
done
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_1200 start`
);
function
onVisibleCallBack
(
_
,
data
)
{
if
(
data
.
parameters
.
kind
!=
"visible"
)
{
return
;
}
console
.
info
(
"!!!====>FMS_notifyVisibleForms_1200 onVisibleCallBack data:====>"
+
JSON
.
stringify
(
data
));
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormOnState_commonEvent"
);
expect
(
data
.
data
)
.
assertEqual
(
"0"
);
setTimeout
(
function
()
{
commonEvent
.
unsubscribe
(
subscriberOnState
,
()
=>
unsubscribeOnStateCallback
(
"FMS_notifyVisibleForms_1200"
));
commonEvent
.
unsubscribe
(
subscriberSupply
,
()
=>
unsubscribeSupplyCallback
(
"FMS_notifyVisibleForms_1200"
));
let
commonEventPublishData
=
{
data
:
data
.
parameters
.
formId
};
commonEvent
.
publish
(
deleteForm_Event
,
commonEventPublishData
,
()
=>
delPublishCallback
(
"FMS_notifyVisibleForms_1200"
,
done
));
},
2000
);
}
function
onSupplyEventCallBack
(
_
,
data
)
{
if
(
data
.
parameters
.
kind
!=
"onVisibilityChange"
)
{
return
;
}
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormSupply_commonEvent"
);
commonEvent
.
unsubscribe
(
subscriberSupply
,
()
=>
unsubscribeSupplyCallback
(
"FMS_notifyVisibleForms_1200"
));
console
.
debug
(
"====>FMS_notifyVisibleForms_1200 onSupplyEventCallBack====>"
+
JSON
.
stringify
(
data
));
console
.
log
(
`FMS_notifyVisibleForms_1200 error`
);
expect
()
.
assertFail
();
}
commonEvent
.
subscribe
(
subscriberOnState
,
onVisibleCallBack
);
commonEvent
.
subscribe
(
subscriberSupply
,
onSupplyEventCallBack
);
console
.
log
(
`FMS_notifyVisibleForms_1200 featureAbility.startAbility start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostg"
,
abilityName
:
"com.ohos.st.formsystemhostg.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestservicenotsysapp.hmservice"
,
"ability"
:
"com.form.formsystemtestservicenotsysapp.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"stateForm"
:
"visible"
,
"stateIds"
:
[
"self"
],
"isCreate"
:
true
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_1200 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_1200 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
});
console
.
log
(
`FMS_notifyVisibleForms_1200 featureAbility.startAbility end`
);
});
/**
* @tc.number: FMS_notifyVisibleForms_1300
* @tc.name: Provider onVisibleChange can not be called when formVisibleNotify is false.
* @tc.desc: 1.The form user calls the visible notification interface.
* 2.Verify the result of the onVisibleChange interface.
*/
it
(
`FMS_notifyVisibleForms_1300`
,
0
,
async
(
done
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_1300 start`
);
function
OnVisibleCallBack
(
_
,
data
)
{
if
(
data
.
parameters
.
kind
!=
"visible"
)
{
return
;
}
console
.
info
(
"!!!====>FMS_notifyVisibleForms_1300 OnVisibleCallBack data:====>"
+
JSON
.
stringify
(
data
));
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormOnState_commonEvent"
);
expect
(
data
.
data
)
.
assertEqual
(
"0"
);
commonEvent
.
unsubscribe
(
subscriberOnState
,
()
=>
unsubscribeOnStateCallback
(
"FMS_notifyVisibleForms_1300"
));
let
commonEventPublishData
=
{
data
:
data
.
parameters
.
formId
};
commonEvent
.
publish
(
deleteForm_Event
,
commonEventPublishData
,
()
=>
delPublishCallback
(
"FMS_notifyVisibleForms_1300"
,
done
));
}
commonEvent
.
subscribe
(
subscriberOnState
,
OnVisibleCallBack
);
console
.
log
(
`FMS_notifyVisibleForms_1300 featureAbility.startAbility start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostg"
,
abilityName
:
"com.ohos.st.formsystemhostg.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestserviced.hmservice"
,
"ability"
:
"com.form.formsystemtestserviced.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"stateForm"
:
"visible"
,
"stateIds"
:
[
"self"
],
"isCreate"
:
true
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_1300 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_1300 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
});
console
.
log
(
`FMS_notifyVisibleForms_1300 featureAbility.startAbility end`
);
});
/**
* @tc.number: FMS_notifyVisibleForms_1400
* @tc.name: formVisibleNotify in config.json is true,
* it can notify the form provider that the form is not visible.
* @tc.desc: 1. The card is created successfully.
* 2. The visibility interface is successfully invoked.
* The visibility notification of form provider A is triggered,
* and the formId is the same as that of the created formId.
*/
it
(
`FMS_notifyVisibleForms_1400`
,
0
,
async
(
done
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_1400 start`
);
let
supplyFlag
=
false
;
let
formId1
;
let
formId2
;
let
delCount
=
0
;
let
onSupplyCount
=
0
;
function
delPublishCallBack
()
{
console
.
info
(
"!!!====>FMS_notifyVisibleForms_1400 delPublishCallBack====>"
);
delCount
++
;
if
(
delCount
==
2
)
{
setTimeout
(
function
()
{
commonEvent
.
unsubscribe
(
subscriberSupply
,
()
=>
unsubscribeSupplyCallback
(
"FMS_notifyVisibleForms_1400"
));
if
(
supplyFlag
)
{
expect
()
.
assertFail
();
}
console
.
info
(
'FMS_notifyVisibleForms_1400 delPublishCallBack end'
);
console
.
info
(
'FMS_notifyVisibleForms_1400 end'
);
done
();
},
1000
);
}
}
function
onAcquiredCallBack_Normal1
(
_
,
data
)
{
console
.
info
(
"!!!====>FMS_notifyVisibleForms_1400 onAcquiredCallBack_Normal1 data:====>"
+
JSON
.
stringify
(
data
));
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormOnAcquired_commonEvent"
);
commonEvent
.
unsubscribe
(
subscriberOnAcquired
,
unSubscribeOnAcquiredCallBack_Normal1
)
formId1
=
data
.
data
;
FMS_notifyVisibleForms_1400_normal2
();
}
function
unSubscribeOnAcquiredCallBack_Normal1
()
{
console
.
debug
(
"====>FMS_notifyVisibleForms_1400 unSubscribeOnAcquiredCallBack_Normal2====>"
);
}
async
function
FMS_notifyVisibleForms_1400_normal1
()
{
console
.
log
(
`FMS_notifyVisibleForms_1400_normal1 start`
);
commonEvent
.
subscribe
(
subscriberOnAcquired
,
onAcquiredCallBack_Normal1
);
console
.
log
(
`FMS_notifyVisibleForms_1400_normal1 featureAbility.startAbility start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostg"
,
abilityName
:
"com.ohos.st.formsystemhostg.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestservicea.hmservice"
,
"ability"
:
"com.form.formsystemtestservicea.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"isCreate"
:
true
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_1400_normal1 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_1400_normal1 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
});
console
.
log
(
`FMS_notifyVisibleForms_1400_normal1 featureAbility.startAbility end`
);
console
.
log
(
`FMS_notifyVisibleForms_1400_normal1 end`
);
}
function
onStateCallBack
(
_
,
data
)
{
console
.
info
(
"!!!====>FMS_notifyVisibleForms_1400 onStateCallBack data:====>"
+
JSON
.
stringify
(
data
));
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormOnState_commonEvent"
);
expect
(
data
.
data
)
.
assertEqual
(
"0"
);
commonEvent
.
unsubscribe
(
subscriberOnState
,
()
=>
unsubscribeOnStateCallback
(
"FMS_notifyVisibleForms_1400"
))
console
.
info
(
"!!!====>FMS_notifyVisibleForms_1400 onStateCallBack formId1:====>"
+
formId1
);
console
.
info
(
"!!!====>FMS_notifyVisibleForms_1400 onStateCallBack formId2:====>"
+
formId2
);
console
.
info
(
"!!!====>FMS_notifyVisibleForms_1400 onStateCallBack onSupplyCount:====>"
+
onSupplyCount
);
if
(
formId1
&&
formId2
&&
onSupplyCount
==
1
)
{
let
commonEventPublishData
=
{
data
:
formId1
};
commonEvent
.
publish
(
deleteForm_Event
,
commonEventPublishData
,
delPublishCallBack
);
let
commonEventPublishData2
=
{
data
:
formId2
};
commonEvent
.
publish
(
deleteForm_Event
,
commonEventPublishData2
,
delPublishCallBack
);
}
}
async
function
onAcquiredCallBack_Normal2
(
_
,
data
)
{
console
.
info
(
"!!!====>FMS_notifyVisibleForms_1400 onAcquiredCallBack_Normal2 data:====>"
+
JSON
.
stringify
(
data
));
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormOnAcquired_commonEvent"
);
commonEvent
.
unsubscribe
(
subscriberOnAcquired
,
unSubscribeOnAcquiredCallBack_Normal2
);
formId2
=
data
.
data
;
commonEvent
.
subscribe
(
subscriberOnState
,
onStateCallBack
);
console
.
log
(
`FMS_notifyVisibleForms_1400 featureAbility.startAbility start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostg"
,
abilityName
:
"com.ohos.st.formsystemhostg.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestservicea.hmservice"
,
"ability"
:
"com.form.formsystemtestservicea.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"stateForm"
:
"visible"
,
"stateIds"
:
[
formId1
,
formId2
],
"isCreate"
:
true
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_1400 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_1400 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
});
console
.
log
(
`FMS_notifyVisibleForms_1400 featureAbility.startAbility end`
);
}
function
unSubscribeOnAcquiredCallBack_Normal2
()
{
console
.
debug
(
"====>FMS_notifyVisibleForms_1400 unSubscribeOnAcquiredCallBack_Normal2====>"
);
}
async
function
FMS_notifyVisibleForms_1400_normal2
()
{
subscriberOnAcquired
=
await
commonEvent
.
createSubscriber
(
onAcquiredForm_Event
);
commonEvent
.
subscribe
(
subscriberOnAcquired
,
onAcquiredCallBack_Normal2
);
console
.
log
(
`FMS_notifyVisibleForms_1400_normal2 featureAbility.startAbility start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostg"
,
abilityName
:
"com.ohos.st.formsystemhostg.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestserviced.hmservice"
,
"ability"
:
"com.form.formsystemtestserviced.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"isCreate"
:
true
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_1400_normal2 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_1400_normal2 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
});
console
.
log
(
`FMS_notifyVisibleForms_1400_normal2 featureAbility.startAbility end`
);
}
function
onSupplyCallBack
(
_
,
data
)
{
if
(
data
.
parameters
.
kind
==
"onVisibilityChange"
)
{
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormSupply_commonEvent"
);
console
.
debug
(
"====>FMS_notifyVisibleForms_1400 onSupplyCallBack====>"
+
JSON
.
stringify
(
data
));
let
parameters
=
JSON
.
parse
(
data
.
parameters
.
parameters
);
if
(
parameters
[
formId1
])
{
expect
(
parameters
[
formId1
])
.
assertEqual
(
1
);
}
if
(
parameters
[
formId2
])
{
expect
(
parameters
[
formId2
])
.
assertEqual
(
1
);
}
onSupplyCount
++
;
if
(
onSupplyCount
==
2
)
{
supplyFlag
=
true
;
commonEvent
.
unsubscribe
(
subscriberSupply
,
()
=>
unsubscribeSupplyCallback
(
"FMS_notifyVisibleForms_1400"
));
}
if
(
formId1
&&
formId2
)
{
let
commonEventPublishData
=
{
data
:
formId1
};
commonEvent
.
publish
(
deleteForm_Event
,
commonEventPublishData
,
delPublishCallBack
);
let
commonEventPublishData2
=
{
data
:
formId2
};
commonEvent
.
publish
(
deleteForm_Event
,
commonEventPublishData2
,
delPublishCallBack
);
}
}
}
commonEvent
.
subscribe
(
subscriberSupply
,
onSupplyCallBack
);
FMS_notifyVisibleForms_1400_normal1
();
});
/**
* @tc.number: FMS_notifyVisibleForms_1500
* @tc.name: Created provider A and B form card, notify the form to be visible 3times.
* @tc.desc: 1.The form user calls the visible notification interface.
* 2.Verify the result of the visible notification interface.
*/
it
(
`FMS_notifyVisibleForms_1500`
,
0
,
async
(
done
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_1500 start`
);
let
formIds
=
new
Array
();
let
count
=
0
;
function
delPublishCallBack1
(
_
,
data
)
{
console
.
info
(
"!!!====>FMS_notifyVisibleForms_1500 delPublishCallBack1====>"
+
JSON
.
stringify
(
data
));
setTimeout
(
function
()
{
console
.
info
(
'FMS_notifyVisibleForms_1500 delPublishCallBack1 end'
);
console
.
log
(
`FMS_notifyVisibleForms_1500 end`
);
},
1000
);
}
function
delPublishCallBack2
(
_
,
data
)
{
console
.
info
(
"!!!====>FMS_notifyVisibleForms_1500 delPublishCallBack2====>"
+
JSON
.
stringify
(
data
));
setTimeout
(
function
()
{
console
.
info
(
'FMS_notifyVisibleForms_1500 delPublishCallBack2 end'
);
console
.
log
(
`FMS_notifyVisibleForms_1500 end`
);
done
();
},
1000
);
}
function
onInVisibleSupplyCallBack
(
_
,
data
)
{
if
(
data
.
parameters
.
kind
==
"onVisibilityChange"
)
{
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormSupply_commonEvent"
);
console
.
debug
(
"====>FMS_notifyVisibleForms_1500 onInVisibleSupplyCallBack====>"
+
JSON
.
stringify
(
data
));
let
retFormId
=
Object
.
keys
(
JSON
.
parse
(
data
.
parameters
.
parameters
))[
0
];
const
visibilityStatus
=
JSON
.
parse
(
data
.
parameters
.
parameters
)[
retFormId
];
expect
(
formIds
.
includes
(
retFormId
))
.
assertTrue
();
expect
(
visibilityStatus
)
.
assertEqual
(
2
);
++
count
;
if
(
count
==
12
)
{
commonEvent
.
unsubscribe
(
subscriberSupply
,
()
=>
unsubscribeSupplyCallback
(
"FMS_notifyVisibleForms_1500"
));
let
commonEventPublishData1
=
{
data
:
formIds
[
0
]
};
commonEvent
.
publish
(
deleteForm_Event
,
commonEventPublishData1
,
delPublishCallBack1
);
let
commonEventPublishData2
=
{
data
:
formIds
[
1
]
};
commonEvent
.
publish
(
deleteForm_Event
,
commonEventPublishData2
,
delPublishCallBack2
);
}
}
}
async
function
onVisibleSupplyCallBack
(
_
,
data
)
{
if
(
data
.
parameters
.
kind
==
"onVisibilityChange"
)
{
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormSupply_commonEvent"
);
console
.
debug
(
"====>FMS_notifyVisibleForms_1500 onVisibleSupplyCallBack====>"
+
JSON
.
stringify
(
data
));
let
retFormId
=
Object
.
keys
(
JSON
.
parse
(
data
.
parameters
.
parameters
))[
0
];
const
visibilityStatus
=
JSON
.
parse
(
data
.
parameters
.
parameters
)[
retFormId
];
expect
(
formIds
.
includes
(
retFormId
))
.
assertTrue
();
expect
(
visibilityStatus
)
.
assertEqual
(
1
);
++
count
;
if
(
count
==
6
)
{
commonEvent
.
unsubscribe
(
subscriberSupply
,
()
=>
unsubscribeSupplyCallback
(
"FMS_notifyVisibleForms_1500"
));
subscriberSupply
=
await
commonEvent
.
createSubscriber
(
onSupplyEvent
);
commonEvent
.
subscribe
(
subscriberSupply
,
onInVisibleSupplyCallBack
);
console
.
log
(
`FMS_notifyVisibleForms_1500 featureAbility.startAbility notifyInvisible start`
);
for
(
var
i
=
0
;
i
<
3
;
i
++
)
{
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostg"
,
abilityName
:
"com.ohos.st.formsystemhostg.MainAbility"
,
parameters
:
{
"stateForm"
:
"invisible"
,
"stateIds"
:
formIds
,
"isCreate"
:
false
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_1500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_1500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
});
}
console
.
log
(
`FMS_notifyVisibleForms_1500 featureAbility.startAbility notifyInvisible end`
);
}
}
}
async
function
onAcquiredCallBack2
(
_
,
data
)
{
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormOnAcquired_commonEvent"
);
commonEvent
.
unsubscribe
(
subscriberOnAcquired
,
()
=>
unsubscribeSupplyCallback
(
"FMS_notifyVisibleForms_1500"
));
console
.
debug
(
"====>FMS_notifyVisibleForms_1500 onAcquiredCallBack2====>"
+
JSON
.
stringify
(
data
));
formIds
.
push
(
data
.
data
);
console
.
debug
(
"====>FMS_notifyVisibleForms_1500 formIds====>"
+
formIds
);
commonEvent
.
subscribe
(
subscriberSupply
,
onVisibleSupplyCallBack
);
console
.
log
(
`FMS_notifyVisibleForms_1500 featureAbility.startAbility notifyVisible start`
);
for
(
var
i
=
0
;
i
<
3
;
i
++
)
{
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostg"
,
abilityName
:
"com.ohos.st.formsystemhostg.MainAbility"
,
parameters
:
{
"stateForm"
:
"visible"
,
"stateIds"
:
formIds
,
"isCreate"
:
false
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_1500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_1500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
});
}
console
.
log
(
`FMS_notifyVisibleForms_1500 featureAbility.startAbility notifyVisible end`
);
}
async
function
onAcquiredCallBack1
(
_
,
data
)
{
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormOnAcquired_commonEvent"
);
commonEvent
.
unsubscribe
(
subscriberOnAcquired
,
()
=>
unsubscribeSupplyCallback
(
"FMS_notifyVisibleForms_1500"
));
console
.
debug
(
"====>FMS_notifyVisibleForms_1500 onAcquiredCallBack1====>"
+
JSON
.
stringify
(
data
));
formIds
.
push
(
data
.
data
);
console
.
debug
(
"====>FMS_notifyVisibleForms_1500 formIds====>"
+
JSON
.
stringify
(
formIds
));
subscriberOnAcquired
=
await
commonEvent
.
createSubscriber
(
onAcquiredForm_Event
);
commonEvent
.
subscribe
(
subscriberOnAcquired
,
onAcquiredCallBack2
);
console
.
log
(
`FMS_notifyVisibleForms_1500 featureAbility.startAbility serviceb start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostg"
,
abilityName
:
"com.ohos.st.formsystemhostg.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestserviceb.hmservice"
,
"ability"
:
"com.form.formsystemtestserviceb.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"isCreate"
:
true
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_1500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_1500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
});
console
.
log
(
`FMS_notifyVisibleForms_1500 featureAbility.startAbility serviceb end`
);
}
commonEvent
.
subscribe
(
subscriberOnAcquired
,
onAcquiredCallBack1
);
console
.
log
(
`FMS_notifyVisibleForms_1500 featureAbility.startAbility servicea start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostg"
,
abilityName
:
"com.ohos.st.formsystemhostg.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestservicea.hmservice"
,
"ability"
:
"com.form.formsystemtestservicea.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"isCreate"
:
true
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_1500 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_1500 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
});
console
.
log
(
`FMS_notifyVisibleForms_1500 featureAbility.startAbility servicea end`
);
});
/**
* @tc.number: FMS_notifyVisibleForms_1600
* @tc.name: Use -1 and created form card Id notify the form to be visible.
* @tc.desc: 1.The form user calls the visible notification interface.
* 2.Verify the result of the visible notification interface.
*/
it
(
`FMS_notifyVisibleForms_1600`
,
0
,
async
(
done
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_1600 start`
);
let
formIds
=
new
Array
();
let
count
=
0
;
function
delPublishCallBack1
(
_
,
data
)
{
console
.
info
(
"!!!====>FMS_notifyVisibleForms_1600 delPublishCallBack1====>"
+
JSON
.
stringify
(
data
));
setTimeout
(
function
()
{
console
.
info
(
'FMS_notifyVisibleForms_1600 delPublishCallBack1 end'
);
console
.
log
(
`FMS_notifyVisibleForms_1600 end`
);
},
1000
);
}
function
delPublishCallBack2
(
_
,
data
)
{
console
.
info
(
"!!!====>FMS_notifyVisibleForms_1600 delPublishCallBack2====>"
+
JSON
.
stringify
(
data
));
setTimeout
(
function
()
{
console
.
info
(
'FMS_notifyVisibleForms_1600 delPublishCallBack2 end'
);
console
.
log
(
`FMS_notifyVisibleForms_1600 end`
);
done
();
},
1000
);
}
function
onSupplyCallBack
(
_
,
data
)
{
if
(
data
.
parameters
.
kind
==
"onVisibilityChange"
)
{
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormSupply_commonEvent"
);
console
.
debug
(
"====>FMS_notifyVisibleForms_1600 onSupplyCallBack====>"
+
JSON
.
stringify
(
data
));
let
retFormId
=
Object
.
keys
(
JSON
.
parse
(
data
.
parameters
.
parameters
))[
0
];
const
visibilityStatus
=
JSON
.
parse
(
data
.
parameters
.
parameters
)[
retFormId
];
expect
(
formIds
.
includes
(
retFormId
))
.
assertTrue
();
expect
(
visibilityStatus
)
.
assertEqual
(
1
);
++
count
;
if
(
count
==
2
)
{
console
.
debug
(
"====>FMS_notifyVisibleForms_1600 OK====>"
);
commonEvent
.
unsubscribe
(
subscriberSupply
,
()
=>
unsubscribeSupplyCallback
(
"FMS_notifyVisibleForms_1500"
));
let
commonEventPublishData1
=
{
data
:
formIds
[
0
]
};
commonEvent
.
publish
(
deleteForm_Event
,
commonEventPublishData1
,
delPublishCallBack1
);
let
commonEventPublishData2
=
{
data
:
formIds
[
1
]
};
commonEvent
.
publish
(
deleteForm_Event
,
commonEventPublishData2
,
delPublishCallBack2
);
}
}
}
async
function
onSecondAcquiredCallBack
(
_
,
data
)
{
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormOnAcquired_commonEvent"
);
commonEvent
.
unsubscribe
(
subscriberOnAcquired
,
()
=>
unsubscribeOnAcquiredCallback
(
"FMS_notifyVisibleForms_1500"
));
console
.
debug
(
"====>FMS_notifyVisibleForms_1600 onSecondAcquiredCallBack====>"
+
JSON
.
stringify
(
data
));
formIds
.
push
(
data
.
data
);
formIds
.
push
(
"-1"
);
console
.
debug
(
"====>FMS_notifyVisibleForms_1600 formIds====>"
+
formIds
);
commonEvent
.
subscribe
(
subscriberSupply
,
onSupplyCallBack
);
console
.
log
(
`FMS_notifyVisibleForms_1600 featureAbility.startAbility notifyVisible start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostg"
,
abilityName
:
"com.ohos.st.formsystemhostg.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"name"
,
"bundle"
:
"bundle"
,
"ability"
:
"ability"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"stateForm"
:
"visible"
,
"stateIds"
:
formIds
,
"isCreate"
:
false
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_1600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_1600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
});
console
.
log
(
`FMS_notifyVisibleForms_1600 featureAbility.startAbility notifyVisible end`
);
}
async
function
onFirstAcquiredCallBack
(
_
,
data
)
{
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormOnAcquired_commonEvent"
);
commonEvent
.
unsubscribe
(
subscriberOnAcquired
,
()
=>
unsubscribeOnAcquiredCallback
(
"FMS_notifyVisibleForms_1500"
));
console
.
debug
(
"====>FMS_notifyVisibleForms_1600 onFirstAcquiredCallBack====>"
+
JSON
.
stringify
(
data
));
formIds
.
push
(
data
.
data
);
subscriberOnAcquired
=
await
commonEvent
.
createSubscriber
(
onAcquiredForm_Event
);
commonEvent
.
subscribe
(
subscriberOnAcquired
,
onSecondAcquiredCallBack
);
console
.
log
(
`FMS_notifyVisibleForms_1600 featureAbility.startAbility serviceb start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostg"
,
abilityName
:
"com.ohos.st.formsystemhostg.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestserviceb.hmservice"
,
"ability"
:
"com.form.formsystemtestserviceb.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"isCreate"
:
true
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_1600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_1600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
});
console
.
log
(
`FMS_notifyVisibleForms_1600 featureAbility.startAbility serviceb end`
);
}
commonEvent
.
subscribe
(
subscriberOnAcquired
,
onFirstAcquiredCallBack
);
console
.
log
(
`FMS_notifyVisibleForms_1600 featureAbility.startAbility servicea start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostg"
,
abilityName
:
"com.ohos.st.formsystemhostg.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestservicea.hmservice"
,
"ability"
:
"com.form.formsystemtestservicea.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"isCreate"
:
true
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_1600 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_1600 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
});
console
.
log
(
`FMS_notifyVisibleForms_1600 featureAbility.startAbility servicea end`
);
});
/**
* @tc.number: FMS_notifyVisibleForms_1700
* @tc.name: Use -1 and created form card Id notify the form to be visible.
* @tc.desc: 1.The form user calls the visible notification interface.
* 2.Verify the result of the visible notification interface.
*/
it
(
`FMS_notifyVisibleForms_1700`
,
0
,
async
(
done
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_1700 start`
);
function
onFormVisibleCallBack
(
_
,
data
)
{
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormOnState_commonEvent"
);
commonEvent
.
unsubscribe
(
subscriberOnState
,
()
=>
unsubscribeSupplyCallback
(
"FMS_notifyVisibleForms_1700"
));
console
.
debug
(
"====>FMS_notifyVisibleForms_1700 onFirstAcquiredCallBack====>"
+
JSON
.
stringify
(
data
));
expect
(
data
.
parameters
.
kind
)
.
assertEqual
(
"visible"
);
expect
(
data
.
data
)
.
assertEqual
(
"0"
);
setTimeout
(
function
()
{
let
commonEventPublishData
=
{
data
:
data
.
parameters
.
formId
};
commonEvent
.
publish
(
deleteForm_Event
,
commonEventPublishData
,
()
=>
delPublishCallback
(
"FMS_notifyVisibleForms_1700"
,
done
));
},
2000
);
}
function
onFormSupplyCallBack
(
_
,
data
)
{
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormSupply_commonEvent"
);
commonEvent
.
unsubscribe
(
subscriberSupply
,
()
=>
unsubscribeSupplyCallback
(
"FMS_notifyVisibleForms_1700"
));
console
.
debug
(
"====>FMS_notifyVisibleForms_1700 onFormSupplyCallBack====>"
+
JSON
.
stringify
(
data
));
if
(
data
.
parameters
.
kind
==
"onVisibilityChange"
)
{
console
.
debug
(
"====>FMS_notifyVisibleForms_1700 error"
);
expect
()
.
assertFail
();
}
}
commonEvent
.
subscribe
(
subscriberOnState
,
onFormVisibleCallBack
);
commonEvent
.
subscribe
(
subscriberSupply
,
onFormSupplyCallBack
);
console
.
log
(
`FMS_notifyVisibleForms_1700 featureAbility.startAbility servicea start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostf"
,
abilityName
:
"com.ohos.st.formsystemhostf.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestservicea.hmservice"
,
"ability"
:
"com.form.formsystemtestservicea.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"isCreate"
:
true
,
"isStartOtherApp"
:
true
,
"otherAppState"
:
"visible"
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_1700 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_1700 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
});
console
.
log
(
`FMS_notifyVisibleForms_1700 featureAbility.startAbility servicea end`
);
});
/**
* @tc.number: FMS_notifyVisibleForms_1800
* @tc.name: When formVisibleNotify is true in config.json,
* the form provider will be pulled when the card is visible.
* @tc.desc: 1.The form user calls the visible notification interface.
* 2.Verify the result of the visible notification interface.
*/
it
(
`FMS_notifyVisibleForms_1800`
,
0
,
async
(
done
)
=>
{
console
.
info
(
`FMS_notifyVisibleForms_1800 start`
);
let
hostFormId
;
let
providerFormId
;
let
counter
=
0
;
const
delPublishCallback
=
(
_
,
data
)
=>
{
console
.
info
(
"!!!====>FMS_notifyVisibleForms_1800 delPublishCallback====>"
);
setTimeout
(()
=>
{
expect
(
hostFormId
)
.
assertEqual
(
providerFormId
);
console
.
info
(
'FMS_notifyVisibleForms_1800 delPublishCallback end'
);
console
.
info
(
`FMS_notifyVisibleForms_1800 end`
);
done
();
},
1000
);
}
const
onSupplyCallback
=
(
_
,
data
)
=>
{
if
(
data
.
parameters
.
kind
!=
"onVisibilityChange"
)
{
return
;
}
console
.
debug
(
"====>FMS_notifyVisibleForms_1800 onSupplyCallback data:====>"
+
JSON
.
stringify
(
data
));
providerFormId
=
Object
.
keys
(
JSON
.
parse
(
data
.
parameters
.
parameters
))[
0
];
const
visibilityStatus
=
JSON
.
parse
(
data
.
parameters
.
parameters
)[
providerFormId
];
expect
(
visibilityStatus
)
.
assertEqual
(
1
);
commonEvent
.
unsubscribe
(
subscriberSupply
,
()
=>
{
console
.
info
(
"====>FMS_notifyVisibleForms_1800 unSubscribeSupplyCallback====>"
);
});
if
(
++
counter
==
2
)
{
const
commonEventPublishData
=
{
data
:
providerFormId
};
commonEvent
.
publish
(
deleteForm_Event
,
commonEventPublishData
,
delPublishCallback
);
}
}
const
onVisibleCallback
=
(
_
,
data
)
=>
{
if
(
data
.
parameters
.
kind
!=
"visible"
)
{
return
;
}
console
.
debug
(
"====>FMS_notifyVisibleForms_1800 onVisibleCallback data:====>"
+
JSON
.
stringify
(
data
));
hostFormId
=
data
.
parameters
.
formId
;
expect
(
data
.
data
)
.
assertEqual
(
"0"
);
commonEvent
.
unsubscribe
(
subscriberOnState
,
()
=>
{
console
.
info
(
"====>FMS_notifyVisibleForms_1800 unSubscribeOnVisibleCallback====>"
);
});
if
(
++
counter
==
2
)
{
const
commonEventPublishData
=
{
data
:
hostFormId
};
commonEvent
.
publish
(
deleteForm_Event
,
commonEventPublishData
,
delPublishCallback
);
}
}
commonEvent
.
subscribe
(
subscriberOnState
,
onVisibleCallback
);
commonEvent
.
subscribe
(
subscriberSupply
,
onSupplyCallback
);
console
.
info
(
`FMS_notifyVisibleForms_1800 featureAbility.startAbility start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostg"
,
abilityName
:
"com.ohos.st.formsystemhostg.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestservicef.hmservice"
,
"ability"
:
"com.form.formsystemtestservicef.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"stateForm"
:
"visible"
,
"stateIds"
:
[
"self"
],
"isCreate"
:
true
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
debug
(
`FMS_notifyVisibleForms_1800 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
debug
(
`FMS_notifyVisibleForms_1800 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
});
});
/**
* @tc.number: FMS_notifyVisibleForms_1900
* @tc.name: The size of visible form ids in the notification form array exceeds 32.
* @tc.desc: 1. Failed to invoke the visibility interface (parameter error).
*/
it
(
`FMS_notifyVisibleForms_1900`
,
0
,
async
(
done
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_1900 start`
);
function
onStateCallBack
(
_
,
data
)
{
console
.
info
(
"!!!====>FMS_notifyVisibleForms_1900 onStateCallBack data:====>"
+
JSON
.
stringify
(
data
));
expect
(
data
.
event
)
.
assertEqual
(
"FMS_FormOnState_commonEvent"
);
expect
(
data
.
data
!=
"0"
)
.
assertEqual
(
true
);
commonEvent
.
unsubscribe
(
subscriberOnState
,
()
=>
unsubscribeOnStateCallback
(
"FMS_notifyVisibleForms_1900"
))
setTimeout
(
function
()
{
console
.
info
(
'FMS_notifyVisibleForms_1900 delPublishCallBack end'
);
console
.
log
(
`FMS_notifyVisibleForms_1900 end`
);
done
();
},
100
);
}
commonEvent
.
subscribe
(
subscriberOnState
,
onStateCallBack
);
console
.
log
(
`FMS_notifyVisibleForms_1900 featureAbility.startAbility start`
);
await
featureAbility
.
startAbility
({
want
:
{
bundleName
:
"com.ohos.st.formsystemhostg"
,
abilityName
:
"com.ohos.st.formsystemhostg.MainAbility"
,
parameters
:
{
"formId"
:
"0"
,
"name"
:
"Form_Js001"
,
"bundle"
:
"com.form.formsystemtestservicea.hmservice"
,
"ability"
:
"com.form.formsystemtestservicea.hmservice.FormAbility"
,
"moduleName"
:
"entry"
,
"temporary"
:
false
,
"stateForm"
:
"visible"
,
"stateIds"
:
[
"1"
,
"2"
,
"3"
,
"4"
,
"5"
,
"6"
,
"7"
,
"8"
,
"9"
,
"10"
,
"11"
,
"12"
,
"13"
,
"14"
,
"15"
,
"16"
,
"17"
,
"18"
,
"19"
,
"20"
,
"21"
,
"22"
,
"23"
,
"24"
,
"25"
,
"26"
,
"27"
,
"28"
,
"29"
,
"30"
,
"31"
,
"32"
,
"33"
],
"isCreate"
:
false
}
}
})
.
then
((
res
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_1900 featureAbility.startAbilityhost res: ${JSON.stringify(res)}`
);
})
.
catch
((
err
:
any
)
=>
{
console
.
log
(
`FMS_notifyVisibleForms_1900 featureAbility.startAbilityhost error: ${JSON.stringify(err)}`
);
});
console
.
log
(
`FMS_notifyVisibleForms_1900 featureAbility.startAbility end`
);
});
});
}
const
sleep
=
async
delay
=>
{
return
new
Promise
((
resolve
,
_
)
=>
{
setTimeout
(
async
()
=>
{
resolve
(
0
);
},
delay
);
});
};
const
delPublishCallback
=
async
(
tcNumber
,
done
)
=>
{
console
.
info
(
`${tcNumber} delPublishCallBack start`
);
setTimeout
(
function
()
{
console
.
info
(
`${tcNumber} delPublishCallBack end`
);
done
();
},
1000
);
}
const
unsubscribeOnStateCallback
=
(
tcNumber
)
=>
{
console
.
debug
(
`====>${tcNumber} unsubscribeOnStateCallback====>`
);
}
const
unsubscribeSupplyCallback
=
(
tcNumber
)
=>
{
console
.
debug
(
`====>${tcNumber} unSubscribeSupplyCallback====>`
);
}
const
unsubscribeOnAcquiredCallback
=
(
tcNumber
)
=>
{
console
.
debug
(
`====>${tcNumber} unsubscribeOnAcquiredCallback====>`
);
}
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/test/List.test.ets
已删除
100644 → 0
浏览文件 @
3413a1fd
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import test from './FmsFormStateNotifyVisible.test.ets';
export default function testsuite() {
test();
}
\ No newline at end of file
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/resources/base/element/string.json
已删除
100644 → 0
浏览文件 @
3413a1fd
{
"string"
:
[
{
"name"
:
"entry_MainAbility"
,
"value"
:
"formvisiblestatetest"
},
{
"name"
:
"description_mainability"
,
"value"
:
"ETS_Empty Ability"
},
{
"name"
:
"TestAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"TestAbility_label"
,
"value"
:
"label"
}
]
}
\ No newline at end of file
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/resources/base/media/icon.png
已删除
100644 → 0
浏览文件 @
3413a1fd
6.6 KB
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/signature/openharmony_sx.p7b
已删除
100644 → 0
浏览文件 @
3413a1fd
文件已删除
ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/ets/test/FmsStress.test.ets
浏览文件 @
28ba34e4
...
...
@@ -361,162 +361,6 @@ export default function test() {
}
});
/**
* @tc.number: FMS_stressTest_0900
* @tc.name: Provider update form test.
* @tc.desc: updateForm method working well.
*/
it(`FMS_stressTest_0900`, 0, async (done) => {
const tcNumber = `FMS_stressTest_0900`;
subscribeDeletedEvent(tcNumber, 1, done);
commonEvent.subscribe(onSupplyEventSubscriber, async (err, data) => {
console.info(`${tcNumber} onSupplyCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`);
const kind = data.parameters.kind;
const supplyFormId = `onCreate` == kind
? JSON.parse(data.parameters.parameters).parameters[`ohos.extra.param.key.form_identity`]
: `onVisibilityChange` == kind
? Object.keys(JSON.parse(data.parameters.parameters))[0]
: data.parameters.parameters;
console.info(`${tcNumber} onSupplyCallback formId: ${supplyFormId} kind: ${kind}`);
if (`onUpdateForm` == kind) {
commonEvent.unsubscribe(onSupplyEventSubscriber, () => unsubscribeOnSupplyCallback(tcNumber));
setTimeout(() => {
commonEvent.publish(formOnDeleteEvent, {
parameters: {
formIds: [].concat(supplyFormId)
}
}, () => publishOnDeleteCallback(tcNumber));
}, 500);
console.info(`${tcNumber} onSupplyCallback end`);
done()
}
});
commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => {
const kind = data.parameters.kind;
const formId = data.parameters.formId;
console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`);
console.info(`${tcNumber} onAcquiredCallback formId: ${formId}`);
if (`notifyVisibleForms` == kind) {
expect(err.code).assertEqual(0);
commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeOnAcquiredCallback(tcNumber));
console.info(`${tcNumber} onAcquiredCallback end`);
}
});
try {
const res = await featureAbility.startAbility({
want: {
bundleName: `com.ohos.st.formsystemhostk`,
abilityName: `com.ohos.st.formsystemhostk.MainAbility`,
parameters: {
formId: `0`,
name: `Form_Js001`,
bundle: `com.form.formsystemtestserviceg.hmservice`,
ability: `com.form.formsystemtestserviceg.hmservice.FormAbility`,
moduleName: `entry`,
notifyVisibleForms: true,
isCreate: true
}
}
});
console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`);
} catch (error) {
console.info(`${tcNumber} error: ${JSON.stringify(error)}`);
console.info(`${tcNumber} should not reach here`);
expect().assertFail();
done()
}
});
/**
* @tc.number: FMS_stressTest_1100
* @tc.name: Host notify form's visibility test.
* @tc.desc: notifyVisibleForms and notifyInvisibleForms method working well.
*/
it(`FMS_stressTest_1100`, 0, async (done) => {
const tcNumber = `FMS_stressTest_1100`;
let hostCounter = 0;
let providerCounter = 0;
subscribeDeletedEvent(tcNumber, 1, done);
commonEvent.subscribe(onSupplyEventSubscriber, async (err, data) => {
console.info(`${tcNumber} onSupplyCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`);
const kind = data.parameters.kind;
const supplyFormId = `onCreate` == kind
? JSON.parse(data.parameters.parameters).parameters[`ohos.extra.param.key.form_identity`]
: `onVisibilityChange` == kind
? Object.keys(JSON.parse(data.parameters.parameters))[0]
: data.parameters.parameters;
console.info(`${tcNumber} onSupplyCallback formId: ${supplyFormId} kind: ${kind}`);
if (`onVisibilityChange` == kind) {
if (++providerCounter == 2) {
commonEvent.unsubscribe(onSupplyEventSubscriber, () => unsubscribeOnSupplyCallback(tcNumber));
setTimeout(() => {
commonEvent.publish(formOnDeleteEvent, {
parameters: {
formIds: [].concat(supplyFormId)
}
}, () => publishOnDeleteCallback(tcNumber));
}, 500);
console.info(`${tcNumber} onSupplyCallback end`);
done()
}
}
});
commonEvent.subscribe(onAcquiredEventSubscriber, async (err, data) => {
const kind = data.parameters.kind;
const formId = data.parameters.formId;
console.info(`${tcNumber} onAcquiredCallback data: ${JSON.stringify(data)}, error: ${JSON.stringify(err)}`);
console.info(`${tcNumber} onAcquiredCallback formId: ${formId}`);
if (`notifyVisibleForms` == kind) {
expect(err.code).assertEqual(0);
if (++hostCounter == 2) {
commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeOnAcquiredCallback(tcNumber));
console.info(`${tcNumber} onAcquiredCallback end`);
}
} else if (`notifyInvisibleForms` == kind) {
expect(err.code).assertEqual(0);
if (++hostCounter == 2) {
commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeOnAcquiredCallback(tcNumber));
console.info(`${tcNumber} onAcquiredCallback end`);
}
}
});
try {
const res = await featureAbility.startAbility({
want: {
bundleName: `com.ohos.st.formsystemhostk`,
abilityName: `com.ohos.st.formsystemhostk.MainAbility`,
parameters: {
formId: `0`,
name: `Form_Js001`,
bundle: `com.form.formsystemtestserviceg.hmservice`,
ability: `com.form.formsystemtestserviceg.hmservice.FormAbility`,
moduleName: `entry`,
notifyVisibility: true,
isCreate: true
}
}
});
console.info(`${tcNumber} featureAbility.startAbility res: ${JSON.stringify(res)}`);
} catch (error) {
console.info(`${tcNumber} error: ${JSON.stringify(error)}`);
console.info(`${tcNumber} should not reach here`);
expect().assertFail();
done()
}
});
/**
* @tc.number: FMS_stressTest_1700
* @tc.name: Get forms info test.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录