Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
57c8eb6f
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看板
未验证
提交
57c8eb6f
编写于
2月 17, 2022
作者:
O
openharmony_ci
提交者:
Gitee
2月 17, 2022
浏览文件
操作
浏览文件
下载
差异文件
!1956 【全局资源调度子系统】【master】补充提醒代理用例
Merge pull request !1956 from 南先森/0217
上级
83ea4139
577ef46c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
113 addition
and
2 deletion
+113
-2
resourceschedule/resourceschedule_standard/reminderagent/src/main/js/default/pages/index/index.js
...rd/reminderagent/src/main/js/default/pages/index/index.js
+1
-0
resourceschedule/resourceschedule_standard/reminderagent/src/main/js/default/test/ReminderAgentJs.test.js
...deragent/src/main/js/default/test/ReminderAgentJs.test.js
+112
-2
未找到文件。
resourceschedule/resourceschedule_standard/reminderagent/src/main/js/default/pages/index/index.js
浏览文件 @
57c8eb6f
...
...
@@ -39,6 +39,7 @@ export default {
require
(
'
../../test/List.test
'
)
core
.
execute
()
runDeccjsunit
(
5
)
},
onReady
()
{
},
...
...
resourceschedule/resourceschedule_standard/reminderagent/src/main/js/default/test/ReminderAgentJs.test.js
浏览文件 @
57c8eb6f
...
...
@@ -15,8 +15,6 @@
// @ts-nocheck
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
router
from
'
@system.router
'
import
notification
from
'
@ohos.notification
'
import
reminderAgent
from
'
@ohos.reminderAgent
'
describe
(
'
ReminderAgentTest
'
,
function
()
{
...
...
@@ -630,5 +628,117 @@ describe('ReminderAgentTest', function () {
}
done
();
})
/**
* @tc.number SUB_RESOURCESCHEDULE_REMINDER_AGENT_024
* @tc.name testReminderTypeCalendarFun001
* @tc.desc test cancelAllReminders can cancel all exist reminders with type of calendar.
*/
it
(
'
testReminderTypeCalendarFun001
'
,
0
,
async
function
(
done
)
{
let
timer
=
{
reminderType
:
reminderAgent
.
ReminderType
.
REMINDER_TYPE_TIMER
,
triggerTimeInSeconds
:
100
}
let
calendar
=
{
reminderType
:
reminderAgent
.
ReminderType
.
REMINDER_TYPE_CALENDAR
,
dateTime
:
{
year
:
2025
,
month
:
10
,
day
:
10
,
hour
:
23
,
minute
:
30
}
}
reminderAgent
.
publishReminder
(
timer
).
then
((
reminderId
)
=>
{});
reminderAgent
.
publishReminder
(
calendar
).
then
((
reminderId
)
=>
{});
setTimeout
(()
=>
{
reminderAgent
.
cancelAllReminders
().
then
(()
=>
{
reminderAgent
.
getValidReminders
().
then
((
reminders
)
=>
{
expect
(
reminders
.
length
===
0
).
assertEqual
(
true
);
});
});
},
5000
);
done
();
})
/**
* @tc.number SUB_RESOURCESCHEDULE_REMINDER_AGENT_025
* @tc.name testPublishReminderTypeCalendarFun001
* @tc.desc test pulish reminders with type of calendar.
*/
it
(
'
testReminderTypeCalendarFun001
'
,
0
,
async
function
(
done
)
{
let
calendar
=
{
reminderType
:
reminderAgent
.
ReminderType
.
REMINDER_TYPE_CALENDAR
,
dateTime
:
{
year
:
2025
,
month
:
10
,
day
:
10
,
hour
:
23
,
minute
:
30
},
repeatMonths
:[
2
],
repeatDays
:[
2
],
actionButton
:[
{
title
:
"
close
"
,
type
:
0
},
{
title
:
"
snooze
"
,
type
:
1
}
],
wantAgent
:{
pkgName
:
"
com.oh.phone
"
,
abilityName
:
"
com.oh.phone.MainAbility
"
},
maxScreenWantAgent
:{
pkgName
:
"
com.oh.phone
"
,
abilityName
:
"
com.oh.phone.MainAbility
"
},
ringDuration
:
5
,
snoozeTimes
:
2
,
timeInterval
:
5
,
title
:
"
this is title
"
,
content
:
"
this is content
"
,
expiredContent
:
"
this reminder has expired
"
,
snoozeContent
:
"
remind later
"
,
notificationId
:
100
,
slotType
:
3
}
reminderAgent
.
publishReminder
(
calendar
).
then
((
reminderId
)
=>
{
reminderAgent
.
getValidReminders
().
then
((
reminders
)
=>
{
for
(
let
i
=
0
;
i
<
reminders
.
length
;
i
++
)
{
console
.
log
(
"
getValidReminders =
"
+
JSON
.
stringify
(
reminders
[
i
]));
console
.
log
(
"
getValidReminders, reminderType =
"
+
reminders
[
i
].
reminderType
);
for
(
let
j
=
0
;
j
<
reminders
[
i
].
actionButton
.
length
;
j
++
)
{
console
.
log
(
"
getValidReminders, actionButton.title =
"
+
reminders
[
i
].
actionButton
[
j
].
title
);
console
.
log
(
"
getValidReminders, actionButton.type =
"
+
reminders
[
i
].
actionButton
[
j
].
type
);
}
console
.
log
(
"
getValidReminders, wantAgent.pkgName =
"
+
reminders
[
i
].
wantAgent
.
pkgName
);
console
.
log
(
"
getValidReminders, wantAgent.abilityName =
"
+
reminders
[
i
].
wantAgent
.
abilityName
);
console
.
log
(
"
getValidReminders, maxScreenWantAgent.pkgName =
"
+
reminders
[
i
].
maxScreenWantAgent
.
pkgName
);
console
.
log
(
"
getValidReminders, maxScreenWantAgent.abilityName =
"
+
reminders
[
i
].
maxScreenWantAgent
.
abilityName
);
expect
(
reminders
[
i
].
ringDuration
).
assertEqual
(
5
);
console
.
log
(
"
getValidReminders, ringDuration =
"
+
reminders
[
i
].
ringDuration
);
expect
(
reminders
[
i
].
snoozeTimes
).
assertEqual
(
2
);
console
.
log
(
"
getValidReminders, snoozeTimes =
"
+
reminders
[
i
].
snoozeTimes
);
console
.
log
(
"
getValidReminders, timeInterval =
"
+
reminders
[
i
].
timeInterval
);
expect
(
reminders
[
i
].
title
).
assertEqual
(
"
this is title
"
);
console
.
log
(
"
getValidReminders, title =
"
+
reminders
[
i
].
title
);
expect
(
reminders
[
i
].
content
).
assertEqual
(
"
this is content
"
);
console
.
log
(
"
getValidReminders, content =
"
+
reminders
[
i
].
content
);
expect
(
reminders
[
i
].
expiredContent
).
assertEqual
(
"
this reminder has expired
"
);
console
.
log
(
"
getValidReminders, expiredContent =
"
+
reminders
[
i
].
expiredContent
);
expect
(
reminders
[
i
].
snoozeContent
).
assertEqual
(
"
remind later
"
);
console
.
log
(
"
getValidReminders, snoozeContent =
"
+
reminders
[
i
].
snoozeContent
);
expect
(
reminders
[
i
].
notificationId
).
assertEqual
(
100
);
console
.
log
(
"
getValidReminders, notificationId =
"
+
reminders
[
i
].
notificationId
);
console
.
log
(
"
getValidReminders, slotType =
"
+
reminders
[
i
].
slotType
);
}
})
});
done
();
})
})
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录