Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
07662e49
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看板
未验证
提交
07662e49
编写于
7月 05, 2023
作者:
O
openharmony_ci
提交者:
Gitee
7月 05, 2023
浏览文件
操作
浏览文件
下载
差异文件
!9216 emitter.off()新增一个可选参数。增加xts用例看护emitter.off()接口变更。
Merge pull request !9216 from zhongbaisong/emitter_xts
上级
6c49d718
d5c0e0e5
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
184 addition
and
0 deletion
+184
-0
notification/ces_standard/subscribeandpublish/emittertest/src/main/js/test/EmitterTest.js
...ibeandpublish/emittertest/src/main/js/test/EmitterTest.js
+184
-0
未找到文件。
notification/ces_standard/subscribeandpublish/emittertest/src/main/js/test/EmitterTest.js
浏览文件 @
07662e49
...
...
@@ -32,6 +32,13 @@ export default function EmitterTest() {
}
}
/* EmitterCallbackDummy should not be called */
function
EmitterCallbackDummy
(
eventData
)
{
console
.
info
(
TAG
+
'
eventData.id:
'
+
JSON
.
stringify
(
eventData
.
data
.
id
));
console
.
info
(
TAG
+
'
eventData.content:
'
+
JSON
.
stringify
(
eventData
.
data
.
content
));
expect
(
eventData
.
data
.
content
).
asertFalse
();
}
function
EmitterCallback
(
eventData
)
{
console
.
info
(
TAG
+
'
eventData.id:
'
+
JSON
.
stringify
(
eventData
.
data
.
id
));
console
.
info
(
TAG
+
'
eventData.content:
'
+
JSON
.
stringify
(
eventData
.
data
.
content
));
...
...
@@ -47,6 +54,22 @@ export default function EmitterTest() {
expect
(
eventData
.
data
.
content
).
assertEqual
(
'
message_4
'
);
}
else
if
(
eventData
.
data
.
id
==
5
)
{
expect
(
eventData
.
data
.
content
).
assertEqual
(
'
message_5
'
);
}
else
if
(
eventData
.
data
.
id
==
6
)
{
expect
(
eventData
.
data
.
content
).
assertEqual
(
'
message_6
'
);
}
else
if
(
eventData
.
data
.
id
==
7
)
{
expect
(
eventData
.
data
.
content
).
assertFalse
();
}
else
if
(
eventData
.
data
.
id
==
8
)
{
expect
(
eventData
.
data
.
content
).
assertEqual
(
'
message_8
'
);
}
else
if
(
eventData
.
data
.
id
==
9
)
{
expect
(
eventData
.
data
.
content
).
assertFalse
();
}
else
if
(
eventData
.
data
.
id
==
10
)
{
expect
(
eventData
.
data
.
content
).
assertFalse
();
}
else
if
(
eventData
.
data
.
id
==
11
)
{
expect
(
eventData
.
data
.
content
).
assertFalse
();
}
else
if
(
eventData
.
data
.
id
==
12
)
{
expect
(
eventData
.
data
.
content
).
assertEqual
(
'
message_12
'
);
}
else
if
(
eventData
.
data
.
id
==
13
)
{
expect
(
eventData
.
data
.
content
).
assertEqual
(
'
message_13
'
);
}
}
...
...
@@ -59,6 +82,7 @@ export default function EmitterTest() {
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_CES_EMITTER_TEST_0100 START`
)
innerEvent
.
eventId
=
1
innerEvent
.
priority
=
emitter
.
EventPriority
.
IDLE
eventData
.
data
.
id
=
0
eventData
.
data
.
content
=
'
message_0
'
...
...
@@ -158,6 +182,166 @@ export default function EmitterTest() {
done
()
})
/*
* @tc.number : SUB_NOTIFICATION_CES_EMITTER_TEST_0600
* @tc.name : verify on : off(eventId: number, callback: Callback<EventData>): void
* @tc.desc : emitter.EventPriority.IMMEDIATE
*/
it
(
'
SUB_NOTIFICATION_CES_EMITTER_TEST_0600
'
,
0
,
async
function
(
done
)
{
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_CES_EMITTER_TEST_0600 START`
)
innerEvent
.
eventId
=
6
innerEvent
.
priority
=
emitter
.
EventPriority
.
IMMEDIATE
eventData
.
data
.
id
=
6
eventData
.
data
.
content
=
'
message_6
'
emitter
.
on
(
innerEvent
,
EmitterCallback
)
emitter
.
off
(
6
,
EmitterCallbackDummy
)
emitter
.
emit
(
innerEvent
,
eventData
)
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_CES_EMITTER_TEST_0600 END`
)
done
()
})
/*
* @tc.number : SUB_NOTIFICATION_CES_EMITTER_TEST_0700
* @tc.name : verify on : off(eventId: number, callback: Callback<EventData>): void
* @tc.desc : emitter.EventPriority.IMMEDIATE
*/
it
(
'
SUB_NOTIFICATION_CES_EMITTER_TEST_0700
'
,
0
,
async
function
(
done
)
{
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_CES_EMITTER_TEST_0700 START`
)
innerEvent
.
eventId
=
7
innerEvent
.
priority
=
emitter
.
EventPriority
.
IMMEDIATE
eventData
.
data
.
id
=
7
eventData
.
data
.
content
=
'
message_7
'
emitter
.
on
(
innerEvent
,
EmitterCallback
)
emitter
.
off
(
7
,
EmitterCallback
)
emitter
.
emit
(
innerEvent
,
eventData
)
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_CES_EMITTER_TEST_0700 END`
)
done
()
})
/*
* @tc.number : SUB_NOTIFICATION_CES_EMITTER_TEST_0800
* @tc.name : verify on: off(eventId: number, callback: Callback<EventData>): void
* @tc.desc : emitter.EventPriority.IMMEDIATE
*/
it
(
'
SUB_NOTIFICATION_CES_EMITTER_TEST_0800
'
,
0
,
async
function
(
done
)
{
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_CES_EMITTER_TEST_0800 START`
)
innerEvent
.
eventId
=
8
innerEvent
.
priority
=
emitter
.
EventPriority
.
IMMEDIATE
eventData
.
data
.
id
=
8
eventData
.
data
.
content
=
'
message_8
'
emitter
.
once
(
innerEvent
,
EmitterCallback
)
emitter
.
off
(
8
,
EmitterCallbackDummy
)
emitter
.
emit
(
innerEvent
,
eventData
)
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_CES_EMITTER_TEST_0800 END`
)
done
()
})
/*
* @tc.number : SUB_NOTIFICATION_CES_EMITTER_TEST_0900
* @tc.name : verify on : off(eventId: number, callback: Callback<EventData>): void
* @tc.desc : emitter.EventPriority.IMMEDIATE
*/
it
(
'
SUB_NOTIFICATION_CES_EMITTER_TEST_0900
'
,
0
,
async
function
(
done
)
{
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_CES_EMITTER_TEST_0900 START`
)
innerEvent
.
eventId
=
9
innerEvent
.
priority
=
emitter
.
EventPriority
.
IMMEDIATE
eventData
.
data
.
id
=
9
eventData
.
data
.
content
=
'
message_9
'
emitter
.
once
(
innerEvent
,
EmitterCallback
)
emitter
.
off
(
9
,
EmitterCallback
)
emitter
.
emit
(
innerEvent
,
eventData
)
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_CES_EMITTER_TEST_0900 END`
)
done
()
})
/*
* @tc.number : SUB_NOTIFICATION_CES_EMITTER_TEST_1000
* @tc.name : verify on : off(eventId: number): void
* @tc.desc : emitter.EventPriority.IMMEDIATE
*/
it
(
'
SUB_NOTIFICATION_CES_EMITTER_TEST_1000
'
,
0
,
async
function
(
done
)
{
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_CES_EMITTER_TEST_1000 START`
)
innerEvent
.
eventId
=
10
innerEvent
.
priority
=
emitter
.
EventPriority
.
IMMEDIATE
eventData
.
data
.
id
=
10
eventData
.
data
.
content
=
'
message_10
'
emitter
.
on
(
innerEvent
,
EmitterCallback
)
emitter
.
off
(
10
)
emitter
.
emit
(
innerEvent
,
eventData
)
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_CES_EMITTER_TEST_1000 END`
)
done
()
})
/*
* @tc.number : SUB_NOTIFICATION_CES_EMITTER_TEST_1100
* @tc.name : verify on : off(eventId: number): void
* @tc.desc : emitter.EventPriority.IMMEDIATE
*/
it
(
'
SUB_NOTIFICATION_CES_EMITTER_TEST_1100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_CES_EMITTER_TEST_1100 START`
)
innerEvent
.
eventId
=
11
innerEvent
.
priority
=
emitter
.
EventPriority
.
IMMEDIATE
eventData
.
data
.
id
=
11
eventData
.
data
.
content
=
'
message_11
'
emitter
.
once
(
innerEvent
,
EmitterCallback
)
emitter
.
off
(
11
)
emitter
.
emit
(
innerEvent
,
eventData
)
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_CES_EMITTER_TEST_1100 END`
)
done
()
})
/*
* @tc.number : SUB_NOTIFICATION_CES_EMITTER_TEST_1200
* @tc.name : verify on : off(eventId: number): void
* @tc.desc : emitter.EventPriority.IMMEDIATE
*/
it
(
'
SUB_NOTIFICATION_CES_EMITTER_TEST_1200
'
,
0
,
async
function
(
done
)
{
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_CES_EMITTER_TEST_1200 START`
)
innerEvent
.
eventId
=
12
innerEvent
.
priority
=
emitter
.
EventPriority
.
IMMEDIATE
eventData
.
data
.
id
=
12
eventData
.
data
.
content
=
'
message_12
'
emitter
.
on
(
innerEvent
,
EmitterCallback
)
emitter
.
off
(
1000
)
emitter
.
emit
(
innerEvent
,
eventData
)
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_CES_EMITTER_TEST_1200 END`
)
done
()
})
/*
* @tc.number : SUB_NOTIFICATION_CES_EMITTER_TEST_1300
* @tc.name : verify on : off(eventId: number): void
* @tc.desc : emitter.EventPriority.IMMEDIATE
*/
it
(
'
SUB_NOTIFICATION_CES_EMITTER_TEST_1300
'
,
0
,
async
function
(
done
)
{
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_CES_EMITTER_TEST_1300 START`
)
innerEvent
.
eventId
=
13
innerEvent
.
priority
=
emitter
.
EventPriority
.
IMMEDIATE
eventData
.
data
.
id
=
13
eventData
.
data
.
content
=
'
message_13
'
emitter
.
on
(
innerEvent
,
EmitterCallback
)
emitter
.
off
(
1000
)
emitter
.
emit
(
innerEvent
,
eventData
)
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_CES_EMITTER_TEST_1300 END`
)
done
()
})
console
.
info
(
`
${
TAG
}
SUB_NOTIFICATION_CES_EMITTER_TEST END`
)
})
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录