Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
cb391745
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看板
提交
cb391745
编写于
2月 01, 2023
作者:
Z
zhijianwen
1
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--slot--
Signed-off-by:
N
zhijianwen
<
zhijianwen@huawei.com
>
上级
39147fb2
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
137 addition
and
128 deletion
+137
-128
notification/ans_standard/actsNotificationManagerSlotTest/src/main/js/test/ActsNotificationManagerSlotTest.js
...tTest/src/main/js/test/ActsNotificationManagerSlotTest.js
+93
-120
notification/ans_standard/actsNotificationSlotTest/src/main/js/test/ActsNotificationSlotTest.js
...tionSlotTest/src/main/js/test/ActsNotificationSlotTest.js
+44
-8
未找到文件。
notification/ans_standard/actsNotificationManagerSlotTest/src/main/js/test/ActsNotificationManagerSlotTest.js
浏览文件 @
cb391745
...
@@ -20,6 +20,10 @@ export default function ActsNotificationManagerSlotTest() {
...
@@ -20,6 +20,10 @@ export default function ActsNotificationManagerSlotTest() {
let
TAG
=
'
SUB_NOTIFICATION_ANS_MANAGER_SLOT_TEST ===>
'
let
TAG
=
'
SUB_NOTIFICATION_ANS_MANAGER_SLOT_TEST ===>
'
console
.
info
(
TAG
+
'
SUB_NOTIFICATION_ANS_MANAGER_SLOT_TEST START
'
)
console
.
info
(
TAG
+
'
SUB_NOTIFICATION_ANS_MANAGER_SLOT_TEST START
'
)
function
sleep
(
ms
)
{
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
))
}
afterEach
(
async
function
(
done
)
{
afterEach
(
async
function
(
done
)
{
console
.
info
(
`
${
TAG
}
afterEach START`
)
console
.
info
(
`
${
TAG
}
afterEach START`
)
try
{
try
{
...
@@ -1359,73 +1363,50 @@ export default function ActsNotificationManagerSlotTest() {
...
@@ -1359,73 +1363,50 @@ export default function ActsNotificationManagerSlotTest() {
*/
*/
it
(
'
SUB_NOTIFICATION_ANS_MANAGER_SLOT_TEST_4700
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_NOTIFICATION_ANS_MANAGER_SLOT_TEST_4700
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_NOTIFICATION_ANS_MANAGER_SLOT_TEST_4700 START
'
)
console
.
info
(
TAG
+
'
SUB_NOTIFICATION_ANS_MANAGER_SLOT_TEST_4700 START
'
)
try
{
await
notificationManager
.
addSlot
(
notificationManager
.
SlotType
.
SOCIAL_COMMUNICATION
,
(
err
)
=>
{
await
notificationManager
.
addSlot
(
notificationManager
.
SlotType
.
SOCIAL_COMMUNICATION
).
then
(()
=>
{
if
(
err
)
{
console
.
info
(
`
${
TAG
}
addSlot SOCIAL_COMMUNICATION success`
)
console
.
info
(
`
${
TAG
}
addSlot SOCIAL_COMMUNICATION err:
${
err
}
, errMes:
${
err
.
message
}
`
)
expect
(
true
).
assertTrue
()
expect
(
false
).
assertTrue
()
}).
catch
((
err
)
=>
{
done
()
console
.
info
(
`
${
TAG
}
addSlot SOCIAL_COMMUNICATION err:
${
err
}
, errMes:
${
err
.
message
}
`
)
}
else
{
console
.
info
(
`
${
TAG
}
addSlot SOCIAL_COMMUNICATION success`
)
expect
(
true
).
assertTrue
()
}
})
}
catch
(
err
)
{
console
.
info
(
`
${
TAG
}
addSlot SOCIAL_COMMUNICATION errCode:
${
err
}
, errMes:
${
err
.
message
}
`
)
expect
(
false
).
assertTrue
()
expect
(
false
).
assertTrue
()
done
()
done
()
}
}
)
try
{
await
sleep
(
1000
)
await
notificationManager
.
addSlot
(
notificationManager
.
SlotType
.
SERVICE_INFORMATION
,
(
err
)
=>
{
if
(
err
)
{
await
notificationManager
.
addSlot
(
notificationManager
.
SlotType
.
SERVICE_INFORMATION
).
then
(()
=>
{
console
.
info
(
`
${
TAG
}
addSlot SERVICE_INFORMATION err:
${
err
}
, errMes:
${
err
.
message
}
`
)
console
.
info
(
`
${
TAG
}
addSlot SERVICE_INFORMATION success`
)
expect
(
false
).
assertTrue
()
expect
(
true
).
assertTrue
()
done
()
}).
catch
((
err
)
=>
{
}
else
{
console
.
info
(
`
${
TAG
}
addSlot SERVICE_INFORMATION err:
${
err
}
, errMes:
${
err
.
message
}
`
)
console
.
info
(
`
${
TAG
}
addSlot SERVICE_INFORMATION success`
)
expect
(
true
).
assertTrue
()
}
})
}
catch
(
err
)
{
console
.
info
(
`
${
TAG
}
addSlot SERVICE_INFORMATION errCode:
${
err
}
, errMes:
${
err
.
message
}
`
)
expect
(
false
).
assertTrue
()
expect
(
false
).
assertTrue
()
done
()
done
()
}
}
)
try
{
await
sleep
(
1000
)
await
notificationManager
.
addSlot
(
notificationManager
.
SlotType
.
CONTENT_INFORMATION
,
(
err
)
=>
{
if
(
err
)
{
await
notificationManager
.
addSlot
(
notificationManager
.
SlotType
.
CONTENT_INFORMATION
).
then
(()
=>
{
console
.
info
(
`
${
TAG
}
addSlot CONTENT_INFORMATION err:
${
err
}
, errMes:
${
err
.
message
}
`
)
console
.
info
(
`
${
TAG
}
addSlot CONTENT_INFORMATION success`
)
expect
(
false
).
assertTrue
()
expect
(
true
).
assertTrue
()
done
()
}).
catch
((
err
)
=>
{
}
else
{
console
.
info
(
`
${
TAG
}
addSlot CONTENT_INFORMATION err:
${
err
}
, errMes:
${
err
.
message
}
`
)
console
.
info
(
`
${
TAG
}
addSlot CONTENT_INFORMATION success`
)
expect
(
true
).
assertTrue
()
}
})
}
catch
(
err
)
{
console
.
info
(
`
${
TAG
}
addSlot CONTENT_INFORMATION errCode:
${
err
}
, errMes:
${
err
.
message
}
`
)
expect
(
false
).
assertTrue
()
expect
(
false
).
assertTrue
()
done
()
done
()
}
}
)
try
{
await
sleep
(
1000
)
await
notificationManager
.
addSlot
(
notificationManager
.
SlotType
.
OTHER_TYPES
,
(
err
)
=>
{
if
(
err
)
{
await
notificationManager
.
addSlot
(
notificationManager
.
SlotType
.
OTHER_TYPES
).
then
(()
=>
{
console
.
info
(
`
${
TAG
}
addSlot OTHER_TYPES err:
${
err
}
, errMes:
${
err
.
message
}
`
)
console
.
info
(
`
${
TAG
}
addSlot OTHER_TYPES success`
)
expect
(
false
).
assertTrue
()
expect
(
true
).
assertTrue
()
done
()
}).
catch
((
err
)
=>
{
}
else
{
console
.
info
(
`
${
TAG
}
addSlot OTHER_TYPES err:
${
err
}
, errMes:
${
err
.
message
}
`
)
console
.
info
(
`
${
TAG
}
addSlot OTHER_TYPES success`
)
expect
(
true
).
assertTrue
()
}
})
}
catch
(
err
)
{
console
.
info
(
`
${
TAG
}
addSlot OTHER_TYPES errCode:
${
err
}
, errMes:
${
err
.
message
}
`
)
expect
(
false
).
assertTrue
()
expect
(
false
).
assertTrue
()
done
()
done
()
}
})
await
sleep
(
1000
)
try
{
try
{
await
notificationManager
.
getSlots
((
err
,
NotificationSlot
)
=>
{
await
notificationManager
.
getSlots
((
err
,
NotificationSlot
)
=>
{
...
@@ -1435,10 +1416,18 @@ export default function ActsNotificationManagerSlotTest() {
...
@@ -1435,10 +1416,18 @@ export default function ActsNotificationManagerSlotTest() {
done
()
done
()
}
else
{
}
else
{
console
.
info
(
`
${
TAG
}
getSlots AsyncCallback success:`
+
JSON
.
stringify
(
NotificationSlot
))
console
.
info
(
`
${
TAG
}
getSlots AsyncCallback success:`
+
JSON
.
stringify
(
NotificationSlot
))
expect
(
NotificationSlot
[
0
].
type
).
assertEqual
(
1
)
for
(
let
i
=
0
;
i
<
NotificationSlot
.
length
;
i
++
)
{
expect
(
NotificationSlot
[
1
].
type
).
assertEqual
(
2
)
console
.
info
(
`
${
TAG
}
NotificationSlot[
${
i
}
].type:`
+
JSON
.
stringify
(
NotificationSlot
[
i
].
type
))
expect
(
NotificationSlot
[
2
].
type
).
assertEqual
(
3
)
if
(
NotificationSlot
[
i
].
type
==
1
)
{
expect
(
NotificationSlot
[
3
].
type
).
assertEqual
(
65535
)
expect
(
NotificationSlot
[
i
].
type
).
assertEqual
(
1
)
}
else
if
(
NotificationSlot
[
i
].
type
==
2
)
{
expect
(
NotificationSlot
[
i
].
type
).
assertEqual
(
2
)
}
else
if
(
NotificationSlot
[
i
].
type
==
3
)
{
expect
(
NotificationSlot
[
i
].
type
).
assertEqual
(
3
)
}
else
{
expect
(
NotificationSlot
[
i
].
type
).
assertEqual
(
65535
)
}
}
done
()
done
()
}
}
})
})
...
@@ -1459,80 +1448,64 @@ export default function ActsNotificationManagerSlotTest() {
...
@@ -1459,80 +1448,64 @@ export default function ActsNotificationManagerSlotTest() {
it
(
'
SUB_NOTIFICATION_ANS_MANAGER_SLOT_TEST_4800
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_NOTIFICATION_ANS_MANAGER_SLOT_TEST_4800
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_NOTIFICATION_ANS_MANAGER_SLOT_TEST_4800 START
'
)
console
.
info
(
TAG
+
'
SUB_NOTIFICATION_ANS_MANAGER_SLOT_TEST_4800 START
'
)
try
{
await
notificationManager
.
addSlot
(
notificationManager
.
SlotType
.
SOCIAL_COMMUNICATION
).
then
(()
=>
{
await
notificationManager
.
addSlot
(
notificationManager
.
SlotType
.
SOCIAL_COMMUNICATION
,
(
err
)
=>
{
console
.
info
(
`
${
TAG
}
addSlot SOCIAL_COMMUNICATION success`
)
if
(
err
)
{
expect
(
true
).
assertTrue
()
console
.
info
(
`
${
TAG
}
addSlot SOCIAL_COMMUNICATION err:
${
err
}
, errMes:
${
err
.
message
}
`
)
}).
catch
((
err
)
=>
{
expect
(
false
).
assertTrue
()
console
.
info
(
`
${
TAG
}
addSlot SOCIAL_COMMUNICATION err:
${
err
}
, errMes:
${
err
.
message
}
`
)
done
()
}
else
{
console
.
info
(
`
${
TAG
}
addSlot SOCIAL_COMMUNICATION success`
)
expect
(
true
).
assertTrue
()
}
})
}
catch
(
err
)
{
console
.
info
(
`
${
TAG
}
addSlot SOCIAL_COMMUNICATION errCode:
${
err
}
, errMes:
${
err
.
message
}
`
)
expect
(
false
).
assertTrue
()
expect
(
false
).
assertTrue
()
done
()
done
()
}
}
)
try
{
await
sleep
(
1000
)
await
notificationManager
.
addSlot
(
notificationManager
.
SlotType
.
SERVICE_INFORMATION
,
(
err
)
=>
{
if
(
err
)
{
await
notificationManager
.
addSlot
(
notificationManager
.
SlotType
.
SERVICE_INFORMATION
).
then
(()
=>
{
console
.
info
(
`
${
TAG
}
addSlot SERVICE_INFORMATION err:
${
err
}
, errMes:
${
err
.
message
}
`
)
console
.
info
(
`
${
TAG
}
addSlot SERVICE_INFORMATION success`
)
expect
(
false
).
assertTrue
()
expect
(
true
).
assertTrue
()
done
()
}).
catch
((
err
)
=>
{
}
else
{
console
.
info
(
`
${
TAG
}
addSlot SERVICE_INFORMATION err:
${
err
}
, errMes:
${
err
.
message
}
`
)
console
.
info
(
`
${
TAG
}
addSlot SERVICE_INFORMATION success`
)
expect
(
true
).
assertTrue
()
}
})
}
catch
(
err
)
{
console
.
info
(
`
${
TAG
}
addSlot SERVICE_INFORMATION errCode:
${
err
}
, errMes:
${
err
.
message
}
`
)
expect
(
false
).
assertTrue
()
expect
(
false
).
assertTrue
()
done
()
done
()
}
}
)
try
{
await
sleep
(
1000
)
await
notificationManager
.
addSlot
(
notificationManager
.
SlotType
.
CONTENT_INFORMATION
,
(
err
)
=>
{
if
(
err
)
{
await
notificationManager
.
addSlot
(
notificationManager
.
SlotType
.
CONTENT_INFORMATION
).
then
(()
=>
{
console
.
info
(
`
${
TAG
}
addSlot CONTENT_INFORMATION err:
${
err
}
, errMes:
${
err
.
message
}
`
)
console
.
info
(
`
${
TAG
}
addSlot CONTENT_INFORMATION success`
)
expect
(
false
).
assertTrue
()
expect
(
true
).
assertTrue
()
done
()
}).
catch
((
err
)
=>
{
}
else
{
console
.
info
(
`
${
TAG
}
addSlot CONTENT_INFORMATION err:
${
err
}
, errMes:
${
err
.
message
}
`
)
console
.
info
(
`
${
TAG
}
addSlot CONTENT_INFORMATION success`
)
expect
(
true
).
assertTrue
()
}
})
}
catch
(
err
)
{
console
.
info
(
`
${
TAG
}
addSlot CONTENT_INFORMATION errCode:
${
err
}
, errMes:
${
err
.
message
}
`
)
expect
(
false
).
assertTrue
()
expect
(
false
).
assertTrue
()
done
()
done
()
}
}
)
try
{
await
sleep
(
1000
)
await
notificationManager
.
addSlot
(
notificationManager
.
SlotType
.
OTHER_TYPES
,
(
err
)
=>
{
if
(
err
)
{
await
notificationManager
.
addSlot
(
notificationManager
.
SlotType
.
OTHER_TYPES
).
then
(()
=>
{
console
.
info
(
`
${
TAG
}
addSlot OTHER_TYPES err:
${
err
}
, errMes:
${
err
.
message
}
`
)
console
.
info
(
`
${
TAG
}
addSlot OTHER_TYPES success`
)
expect
(
false
).
assertTrue
()
expect
(
true
).
assertTrue
()
done
()
}).
catch
((
err
)
=>
{
}
else
{
console
.
info
(
`
${
TAG
}
addSlot OTHER_TYPES err:
${
err
}
, errMes:
${
err
.
message
}
`
)
console
.
info
(
`
${
TAG
}
addSlot OTHER_TYPES success`
)
expect
(
true
).
assertTrue
()
}
})
}
catch
(
err
)
{
console
.
info
(
`
${
TAG
}
addSlot OTHER_TYPES errCode:
${
err
}
, errMes:
${
err
.
message
}
`
)
expect
(
false
).
assertTrue
()
expect
(
false
).
assertTrue
()
done
()
done
()
}
})
await
sleep
(
1000
)
await
notificationManager
.
getSlots
().
then
((
NotificationSlot
)
=>
{
await
notificationManager
.
getSlots
().
then
((
NotificationSlot
)
=>
{
console
.
info
(
`
${
TAG
}
getSlots Promise success:`
+
JSON
.
stringify
(
NotificationSlot
))
console
.
info
(
`
${
TAG
}
getSlots Promise success:`
+
JSON
.
stringify
(
NotificationSlot
))
expect
(
NotificationSlot
[
0
].
type
).
assertEqual
(
1
)
for
(
let
i
=
0
;
i
<
NotificationSlot
.
length
;
i
++
)
{
expect
(
NotificationSlot
[
1
].
type
).
assertEqual
(
2
)
console
.
info
(
`
${
TAG
}
NotificationSlot[
${
i
}
].type:`
+
JSON
.
stringify
(
NotificationSlot
[
i
].
type
))
expect
(
NotificationSlot
[
2
].
type
).
assertEqual
(
3
)
if
(
NotificationSlot
[
i
].
type
==
1
)
{
expect
(
NotificationSlot
[
3
].
type
).
assertEqual
(
65535
)
expect
(
NotificationSlot
[
i
].
type
).
assertEqual
(
1
)
}
else
if
(
NotificationSlot
[
i
].
type
==
2
)
{
expect
(
NotificationSlot
[
i
].
type
).
assertEqual
(
2
)
}
else
if
(
NotificationSlot
[
i
].
type
==
3
)
{
expect
(
NotificationSlot
[
i
].
type
).
assertEqual
(
3
)
}
else
{
expect
(
NotificationSlot
[
i
].
type
).
assertEqual
(
65535
)
}
}
done
()
done
()
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
info
(
`
${
TAG
}
getSlots Promise err:
${
err
}
, errMes:
${
err
.
message
}
`
)
console
.
info
(
`
${
TAG
}
getSlots Promise err:
${
err
}
, errMes:
${
err
.
message
}
`
)
...
...
notification/ans_standard/actsNotificationSlotTest/src/main/js/test/ActsNotificationSlotTest.js
浏览文件 @
cb391745
...
@@ -20,6 +20,10 @@ export default function ActsNotificationSlotTest() {
...
@@ -20,6 +20,10 @@ export default function ActsNotificationSlotTest() {
let
TAG
=
'
SUB_NOTIFICATION_ANS_SLOT_TEST ===>
'
let
TAG
=
'
SUB_NOTIFICATION_ANS_SLOT_TEST ===>
'
console
.
info
(
TAG
+
'
SUB_NOTIFICATION_ANS_SLOT_TEST START
'
)
console
.
info
(
TAG
+
'
SUB_NOTIFICATION_ANS_SLOT_TEST START
'
)
function
sleep
(
ms
)
{
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
))
}
afterEach
(
async
function
(
done
)
{
afterEach
(
async
function
(
done
)
{
console
.
info
(
`
${
TAG
}
afterEach START`
)
console
.
info
(
`
${
TAG
}
afterEach START`
)
await
notification
.
removeAllSlots
((
err
)
=>
{
await
notification
.
removeAllSlots
((
err
)
=>
{
...
@@ -1220,6 +1224,8 @@ export default function ActsNotificationSlotTest() {
...
@@ -1220,6 +1224,8 @@ export default function ActsNotificationSlotTest() {
}
}
})
})
await
sleep
(
1000
)
await
notification
.
addSlot
(
notification
.
SlotType
.
SERVICE_INFORMATION
,
(
err
)
=>
{
await
notification
.
addSlot
(
notification
.
SlotType
.
SERVICE_INFORMATION
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
info
(
`
${
TAG
}
addSlot SERVICE_INFORMATION err: +
${
err
.
code
}
`
)
console
.
info
(
`
${
TAG
}
addSlot SERVICE_INFORMATION err: +
${
err
.
code
}
`
)
...
@@ -1231,6 +1237,8 @@ export default function ActsNotificationSlotTest() {
...
@@ -1231,6 +1237,8 @@ export default function ActsNotificationSlotTest() {
}
}
})
})
await
sleep
(
1000
)
await
notification
.
addSlot
(
notification
.
SlotType
.
CONTENT_INFORMATION
,
(
err
)
=>
{
await
notification
.
addSlot
(
notification
.
SlotType
.
CONTENT_INFORMATION
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
info
(
`
${
TAG
}
addSlot CONTENT_INFORMATION err: +
${
err
.
code
}
`
)
console
.
info
(
`
${
TAG
}
addSlot CONTENT_INFORMATION err: +
${
err
.
code
}
`
)
...
@@ -1242,6 +1250,8 @@ export default function ActsNotificationSlotTest() {
...
@@ -1242,6 +1250,8 @@ export default function ActsNotificationSlotTest() {
}
}
})
})
await
sleep
(
1000
)
await
notification
.
addSlot
(
notification
.
SlotType
.
OTHER_TYPES
,
(
err
)
=>
{
await
notification
.
addSlot
(
notification
.
SlotType
.
OTHER_TYPES
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
info
(
`
${
TAG
}
addSlot OTHER_TYPES err: +
${
err
.
code
}
`
)
console
.
info
(
`
${
TAG
}
addSlot OTHER_TYPES err: +
${
err
.
code
}
`
)
...
@@ -1253,6 +1263,8 @@ export default function ActsNotificationSlotTest() {
...
@@ -1253,6 +1263,8 @@ export default function ActsNotificationSlotTest() {
}
}
})
})
await
sleep
(
1000
)
await
notification
.
getSlots
((
err
,
NotificationSlot
)
=>
{
await
notification
.
getSlots
((
err
,
NotificationSlot
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
info
(
`
${
TAG
}
getSlots AsyncCallback err: +
${
err
.
code
}
`
)
console
.
info
(
`
${
TAG
}
getSlots AsyncCallback err: +
${
err
.
code
}
`
)
...
@@ -1260,10 +1272,18 @@ export default function ActsNotificationSlotTest() {
...
@@ -1260,10 +1272,18 @@ export default function ActsNotificationSlotTest() {
done
()
done
()
}
else
{
}
else
{
console
.
info
(
`
${
TAG
}
getSlots AsyncCallback success:`
+
JSON
.
stringify
(
NotificationSlot
))
console
.
info
(
`
${
TAG
}
getSlots AsyncCallback success:`
+
JSON
.
stringify
(
NotificationSlot
))
expect
(
NotificationSlot
[
0
].
type
).
assertEqual
(
1
)
for
(
let
i
=
0
;
i
<
NotificationSlot
.
length
;
i
++
)
{
expect
(
NotificationSlot
[
1
].
type
).
assertEqual
(
2
)
console
.
info
(
`
${
TAG
}
NotificationSlot[
${
i
}
].type:`
+
JSON
.
stringify
(
NotificationSlot
[
i
].
type
))
expect
(
NotificationSlot
[
2
].
type
).
assertEqual
(
3
)
if
(
NotificationSlot
[
i
].
type
==
1
)
{
expect
(
NotificationSlot
[
3
].
type
).
assertEqual
(
65535
)
expect
(
NotificationSlot
[
i
].
type
).
assertEqual
(
1
)
}
else
if
(
NotificationSlot
[
i
].
type
==
2
)
{
expect
(
NotificationSlot
[
i
].
type
).
assertEqual
(
2
)
}
else
if
(
NotificationSlot
[
i
].
type
==
3
)
{
expect
(
NotificationSlot
[
i
].
type
).
assertEqual
(
3
)
}
else
{
expect
(
NotificationSlot
[
i
].
type
).
assertEqual
(
65535
)
}
}
done
()
done
()
}
}
})
})
...
@@ -1290,6 +1310,8 @@ export default function ActsNotificationSlotTest() {
...
@@ -1290,6 +1310,8 @@ export default function ActsNotificationSlotTest() {
}
}
})
})
await
sleep
(
1000
)
await
notification
.
addSlot
(
notification
.
SlotType
.
SERVICE_INFORMATION
,
(
err
)
=>
{
await
notification
.
addSlot
(
notification
.
SlotType
.
SERVICE_INFORMATION
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
info
(
`
${
TAG
}
addSlot SERVICE_INFORMATION err: +
${
err
.
code
}
`
)
console
.
info
(
`
${
TAG
}
addSlot SERVICE_INFORMATION err: +
${
err
.
code
}
`
)
...
@@ -1301,6 +1323,8 @@ export default function ActsNotificationSlotTest() {
...
@@ -1301,6 +1323,8 @@ export default function ActsNotificationSlotTest() {
}
}
})
})
await
sleep
(
1000
)
await
notification
.
addSlot
(
notification
.
SlotType
.
CONTENT_INFORMATION
,
(
err
)
=>
{
await
notification
.
addSlot
(
notification
.
SlotType
.
CONTENT_INFORMATION
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
info
(
`
${
TAG
}
addSlot CONTENT_INFORMATION err: +
${
err
.
code
}
`
)
console
.
info
(
`
${
TAG
}
addSlot CONTENT_INFORMATION err: +
${
err
.
code
}
`
)
...
@@ -1312,6 +1336,8 @@ export default function ActsNotificationSlotTest() {
...
@@ -1312,6 +1336,8 @@ export default function ActsNotificationSlotTest() {
}
}
})
})
await
sleep
(
1000
)
await
notification
.
addSlot
(
notification
.
SlotType
.
OTHER_TYPES
,
(
err
)
=>
{
await
notification
.
addSlot
(
notification
.
SlotType
.
OTHER_TYPES
,
(
err
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
info
(
`
${
TAG
}
addSlot OTHER_TYPES err: +
${
err
.
code
}
`
)
console
.
info
(
`
${
TAG
}
addSlot OTHER_TYPES err: +
${
err
.
code
}
`
)
...
@@ -1323,12 +1349,22 @@ export default function ActsNotificationSlotTest() {
...
@@ -1323,12 +1349,22 @@ export default function ActsNotificationSlotTest() {
}
}
})
})
await
sleep
(
1000
)
await
notification
.
getSlots
().
then
((
NotificationSlot
)
=>
{
await
notification
.
getSlots
().
then
((
NotificationSlot
)
=>
{
console
.
info
(
`
${
TAG
}
getSlots Promise success:`
+
JSON
.
stringify
(
NotificationSlot
))
console
.
info
(
`
${
TAG
}
getSlots Promise success:`
+
JSON
.
stringify
(
NotificationSlot
))
expect
(
NotificationSlot
[
0
].
type
).
assertEqual
(
1
)
for
(
let
i
=
0
;
i
<
NotificationSlot
.
length
;
i
++
)
{
expect
(
NotificationSlot
[
1
].
type
).
assertEqual
(
2
)
console
.
info
(
`
${
TAG
}
NotificationSlot[
${
i
}
].type:`
+
JSON
.
stringify
(
NotificationSlot
[
i
].
type
))
expect
(
NotificationSlot
[
2
].
type
).
assertEqual
(
3
)
if
(
NotificationSlot
[
i
].
type
==
1
)
{
expect
(
NotificationSlot
[
3
].
type
).
assertEqual
(
65535
)
expect
(
NotificationSlot
[
i
].
type
).
assertEqual
(
1
)
}
else
if
(
NotificationSlot
[
i
].
type
==
2
)
{
expect
(
NotificationSlot
[
i
].
type
).
assertEqual
(
2
)
}
else
if
(
NotificationSlot
[
i
].
type
==
3
)
{
expect
(
NotificationSlot
[
i
].
type
).
assertEqual
(
3
)
}
else
{
expect
(
NotificationSlot
[
i
].
type
).
assertEqual
(
65535
)
}
}
done
()
done
()
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
info
(
`
${
TAG
}
getSlots Promise err: +
${
err
.
code
}
`
)
console
.
info
(
`
${
TAG
}
getSlots Promise err: +
${
err
.
code
}
`
)
...
...
鸿蒙社区
@harmonycommunity
mentioned in commit
e51273c2
·
2月 04, 2023
mentioned in commit
e51273c2
mentioned in commit e51273c2f8b7e85cd0aac4590074d74665c29715
开关提交列表
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录