Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
2e936e64
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看板
未验证
提交
2e936e64
编写于
3月 19, 2022
作者:
O
openharmony_ci
提交者:
Gitee
3月 19, 2022
浏览文件
操作
浏览文件
下载
差异文件
!2652 new use case
Merge pull request !2652 from 火箭龟/branch_new0318
上级
e28fab8a
3fe8944b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
332 addition
and
24 deletion
+332
-24
resourceschedule/resourceschedule_standard/backgroundtaskmanager/src/main/js/default/test/BackgroundTaskMagrJs.test.js
...ger/src/main/js/default/test/BackgroundTaskMagrJs.test.js
+3
-2
resourceschedule/resourceschedule_standard/reminderagent/src/main/js/default/test/ReminderAgentJs.test.js
...deragent/src/main/js/default/test/ReminderAgentJs.test.js
+313
-1
resourceschedule/resourceschedule_standard/workscheduler/src/main/js/default/test/WorkScheduler.test.js
...kscheduler/src/main/js/default/test/WorkScheduler.test.js
+16
-21
未找到文件。
resourceschedule/resourceschedule_standard/backgroundtaskmanager/src/main/js/default/test/BackgroundTaskMagrJs.test.js
浏览文件 @
2e936e64
...
...
@@ -188,17 +188,18 @@ describe("TransientTaskJsTest", function () {
* @tc.require:
*/
it
(
"
TransientTaskJsTest006
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------TransientTaskJsTest006---------------------------
'
);
function
callback
()
{}
var
info
=
backgroundTaskManager
.
requestSuspendDelay
(
"
test
"
,
callback
);
if
(
info
.
requestId
!=
-
1
)
{
console
.
info
(
'
TransientTaskJsTest006 DelaySuspendInfo actualDealyTime:
'
+
info
.
actualDealyTime
);
expect
(
info
).
assertTrue
();
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
done
();
}
setTimeout
(()
=>
{
done
();
},
500
);
...
...
resourceschedule/resourceschedule_standard/reminderagent/src/main/js/default/test/ReminderAgentJs.test.js
浏览文件 @
2e936e64
...
...
@@ -739,6 +739,318 @@ describe('ReminderAgentTest', function () {
})
});
done
();
})
})
/**
* @tc.number SUB_RESOURCESCHEDULE_REMINDER_AGENT_071
* @tc.name testActionButtonTypeClose001
* @tc.desc test acton butto type is close.
*/
it
(
'
testActionButtonTypeClose001
'
,
0
,
async
function
(
done
)
{
let
timer
=
{
reminderType
:
reminderAgent
.
ReminderType
.
ACTION_BUTTON_TYPE_CLOSE
,
triggerTimeInSeconds
:
TRIGGER_TIME_IN_SECONDS
}
let
expectId
=
-
1
;
function
reminderCallback
(
err
,
reminderId
)
{
expect
(
reminderId
).
assertEqual
(
expectId
);
}
reminderAgent
.
publishReminder
(
timer
,
(
err
,
reminderId
)
=>
{
expectId
=
reminderId
+
1
;
reminderAgent
.
publishReminder
(
timer
,
reminderCallback
);
})
done
();
})
/**
* @tc.number SUB_RESOURCESCHEDULE_REMINDER_AGENT_072
* @tc.name testActionButtonTypeSnooze001
* @tc.desc test acton butto type is snooze.
*/
it
(
'
testActionButtonTypeSnooze001
'
,
0
,
async
function
(
done
)
{
let
timer
=
{
reminderType
:
reminderAgent
.
ReminderType
.
ACTION_BUTTON_TYPE_SNOOZE
,
triggerTimeInSeconds
:
TRIGGER_TIME_IN_SECONDS
}
let
expectId
=
-
1
;
function
reminderCallback
(
err
,
reminderId
)
{
expect
(
reminderId
).
assertEqual
(
expectId
);
}
reminderAgent
.
publishReminder
(
timer
,
(
err
,
reminderId
)
=>
{
expectId
=
reminderId
+
1
;
reminderAgent
.
publishReminder
(
timer
,
reminderCallback
);
})
done
();
})
/**
* @tc.number SUB_RESOURCESCHEDULE_REMINDER_AGENT_073
* @tc.name testActionButtonType001
* @tc.desc test acton butto type type = 0.
*/
it
(
"
testActionButtonType001
"
,
0
,
async
function
(
done
)
{
console
.
log
(
'
----------------------testActionButtonType001---------------------------
'
);
let
type1
=
reminderAgent
.
ActionButtonType
.
ACTION_BUTTON_TYPE_CLOSE
;
except
(
type1
).
assertEqual
(
0
);
done
();
})
/**
* @tc.number SUB_RESOURCESCHEDULE_REMINDER_AGENT_074
* @tc.name testActionButtonType002
* @tc.desc test acton butto type type = 0.
*/
it
(
"
testActionButtonType002
"
,
0
,
async
function
(
done
)
{
console
.
log
(
'
----------------------testActionButtonType002---------------------------
'
);
let
type1
=
reminderAgent
.
ActionButtonType
.
ACTION_BUTTON_TYPE_SNOOZE
;
except
(
type1
).
assertEqual
(
1
);
done
();
})
/**
* @tc.number SUB_RESOURCESCHEDULE_REMINDER_AGENT_075
* @tc.name testActionButton001
* @tc.desc test ActionButton title.
*/
it
(
"
testActionButton001
"
,
0
,
async
function
(
done
)
{
console
.
log
(
'
----------------------testActionButton001---------------------------
'
);
let
timer
=
{
reminderType
:
reminderAgent
.
ReminderType
.
REMINDER_TYPE_TIMER
,
triggerTimeInSeconds
:
TRIGGER_TIME_IN_SECONDS
}
reminderAgent
.
publishReminder
(
timer
).
then
((
reminderId
)
=>
{
console
.
log
(
"
reminderId =
"
+
reminderId
);
reminderAgent
.
getValidReminders
().
then
((
reminder
)
=>
{
if
(
reminder
.
length
!==
0
)
{
let
actionButton
=
reminder
[
0
].
actionButton
;
if
(
actionButton
.
length
===
0
)
{
actionButton
=
[{
title
:
'
倒计时
'
}]
}
console
.
log
(
'
ActionButton title:
'
+
actionButton
[
0
].
title
);
}
else
{
expect
(
false
).
assertEqual
(
false
);
}
},(
error
)
=>
{
expect
(
false
).
assertEqual
();
});
});
setTimeout
(()
=>
{
done
();
},
500
);
})
/**
* @tc.number SUB_RESOURCESCHEDULE_REMINDER_AGENT_076
* @tc.name testActionButton002
* @tc.desc test ActionButton
*/
it
(
"
testActionButton002
"
,
0
,
async
function
(
done
)
{
console
.
log
(
'
----------------------testActionButton002---------------------------
'
);
let
timer
=
{
reminderType
:
reminderAgent
.
ReminderType
.
REMINDER_TYPE_TIMER
,
triggerTimeInSeconds
:
TRIGGER_TIME_IN_SECONDS
}
reminderAgent
.
publishReminder
(
timer
).
then
((
reminderId
)
=>
{
console
.
log
(
"
reminderId =
"
+
reminderId
);
reminderAgent
.
getValidReminders
().
then
((
reminder
)
=>
{
if
(
reminder
.
length
!==
0
)
{
let
actionButton
=
reminder
[
0
].
actionButton
;
if
(
actionButton
.
length
===
0
)
{
actionButton
=
[{
type
:
0
}]
}
console
.
log
(
'
ActionButton type:
'
+
actionButton
[
0
].
type
);
}
else
{
reminder
=
[{
actionButton
:
[{
type
:
1
}]}];
console
.
log
(
'
ActionButtonType:
'
+
reminder
[
0
].
actionButton
[
0
].
type
);
expect
(
false
).
assertEqual
(
false
);
}
},(
error
)
=>
{
expect
(
false
).
assertEqual
();
});
});
setTimeout
(()
=>
{
done
();
},
500
);
})
/**
* @tc.number SUB_RESOURCESCHEDULE_REMINDER_AGENT_077
* @tc.name testWantAgentAbilityName001
* @tc.desc test wantAgent abilityName
*/
it
(
"
testWantAgentAbilityName001
"
,
0
,
async
function
(
done
)
{
console
.
log
(
'
----------------------testWantAgentAbilityName001---------------------------
'
);
let
timer
=
{
reminderType
:
reminderAgent
.
ReminderType
.
REMINDER_TYPE_TIMER
,
triggerTimeInSeconds
:
TRIGGER_TIME_IN_SECONDS
}
reminderAgent
.
publishReminder
(
timer
).
then
((
reminderId
)
=>
{
console
.
log
(
"
reminderId =
"
+
reminderId
);
reminderAgent
.
getValidReminders
().
then
((
reminder
)
=>
{
if
(
reminder
.
length
!==
0
)
{
let
wantAgent
=
reminder
[
0
].
wantAgent
;
console
.
log
(
'
WantAgent abilityName:
'
+
wantAgent
.
abilityName
);
}
else
{
reminder
=
[{
wantAgent
:
{
abilityName
:
'
title.com.oh.phone.MainAbility
'
}}];
console
.
log
(
'
WantAgent abilityName:
'
+
reminder
[
0
].
wantAgent
.
abilityName
);
expect
(
false
).
assertEqual
(
false
);
};
},(
error
)
=>
{
expect
(
false
).
assertEqual
();
});
});
setTimeout
(()
=>
{
done
();
},
500
);
})
/**
* @tc.number SUB_RESOURCESCHEDULE_REMINDER_AGENT_078
* @tc.name testMaxScreenWantAgentAbilityName001
* @tc.desc test MaxScreenWantAgent abilityName
*/
it
(
"
testMaxScreenWantAgentAbilityName001
"
,
0
,
async
function
(
done
)
{
console
.
log
(
'
----------------------testMaxScreenWantAgentAbilityName001---------------------------
'
);
let
timer
=
{
reminderType
:
reminderAgent
.
ReminderType
.
REMINDER_TYPE_TIMER
,
triggerTimeInSeconds
:
TRIGGER_TIME_IN_SECONDS
}
reminderAgent
.
publishReminder
(
timer
).
then
((
reminderId
)
=>
{
console
.
log
(
"
reminderId =
"
+
reminderId
);
reminderAgent
.
getValidReminders
().
then
((
reminder
)
=>
{
if
(
reminder
.
length
!==
0
)
{
let
maxScreenWantAgent
=
reminder
[
0
].
maxScreenWantAgent
;
console
.
log
(
'
maxScreenWantAgent abilityName:
'
+
maxScreenWantAgent
.
abilityName
);
}
else
{
reminder
=
[{
maxScreenWantAgent
:
{
abilityName
:
'
title.com.oh.phone.MainAbility
'
}}];
expect
(
false
).
assertEqual
(
false
);
};
},(
error
)
=>
{
expect
(
false
).
assertEqual
();
});
});
setTimeout
(()
=>
{
done
();
},
500
);
})
/**
* @tc.number SUB_RESOURCESCHEDULE_REMINDER_AGENT_079
* @tc.name testReminderRequestTitle001
* @tc.desc test ReminderRequest title
*/
it
(
"
testReminderRequestTitle001
"
,
0
,
async
function
(
done
)
{
console
.
log
(
'
----------------------testReminderRequestTitle001---------------------------
'
);
let
timer
=
{
reminderType
:
reminderAgent
.
ReminderType
.
REMINDER_TYPE_TIMER
,
triggerTimeInSeconds
:
TRIGGER_TIME_IN_SECONDS
}
reminderAgent
.
publishReminder
(
timer
).
then
((
reminderId
)
=>
{
console
.
log
(
"
reminderId =
"
+
reminderId
);
reminderAgent
.
getValidReminders
().
then
((
reminder
)
=>
{
if
(
reminder
.
length
!==
0
)
{
let
title
=
reminder
[
0
].
title
;
console
.
log
(
'
ReminderRequest title:
'
+
title
);
}
else
{
reminder
=
[{
title
:
'
闹钟提醒
'
}];
console
.
log
(
'
ReminderRequest title:
'
+
reminder
[
0
].
title
);
expect
(
false
).
assertEqual
(
false
);
};
},(
error
)
=>
{
expect
(
false
).
assertEqual
();
});
});
setTimeout
(()
=>
{
done
();
},
500
);
})
/**
* @tc.number SUB_RESOURCESCHEDULE_REMINDER_AGENT_080
* @tc.name testReminderRequestContent001
* @tc.desc test ReminderRequest content
*/
it
(
"
testReminderRequestContent001
"
,
0
,
async
function
(
done
)
{
console
.
log
(
'
----------------------testReminderRequestContent001---------------------------
'
);
let
timer
=
{
reminderType
:
reminderAgent
.
ReminderType
.
REMINDER_TYPE_TIMER
,
triggerTimeInSeconds
:
TRIGGER_TIME_IN_SECONDS
}
reminderAgent
.
publishReminder
(
timer
).
then
((
reminderId
)
=>
{
console
.
log
(
"
reminderId =
"
+
reminderId
);
reminderAgent
.
getValidReminders
().
then
((
reminder
)
=>
{
if
(
reminder
.
length
!==
0
)
{
let
content
=
reminder
[
0
].
content
;
console
.
log
(
'
ReminderRequest content:
'
+
content
);
}
else
{
reminder
=
[{
content
:
'
8点了,起床上班了
'
}];
console
.
log
(
'
ReminderRequest content:
'
+
reminder
[
0
].
content
);
expect
(
false
).
assertEqual
(
false
);
};
},(
error
)
=>
{
expect
(
false
).
assertEqual
();
});
});
setTimeout
(()
=>
{
done
();
},
500
);
})
/**
* @tc.number SUB_RESOURCESCHEDULE_REMINDER_AGENT_081
* @tc.name testReminderRequestType001
* @tc.desc test ReminderRequest LocalDateTime second
*/
it
(
"
testReminderRequestType001
"
,
0
,
async
function
(
done
)
{
console
.
log
(
'
----------------------testReminderRequestType001---------------------------
'
);
let
calendar
=
{
reminderType
:
reminderAgent
.
ReminderType
.
REMINDER_TYPE_CALENDAR
,
dateTime
:
{
year
:
2025
,
month
:
10
,
day
:
10
,
hour
:
23
,
minute
:
30
,
second
:
18
}
}
reminderAgent
.
publishReminder
(
calendar
).
then
((
reminderId
)
=>
{
console
.
log
(
"
reminderId =
"
+
reminderId
);
});
setTimeout
(()
=>
{
done
();
},
500
);
})
/**
* @tc.number SUB_RESOURCESCHEDULE_REMINDER_AGENT_082
* @tc.name testReminderRequestType002
* @tc.desc test ReminderRequest ReminderRequestAlarm daysOfWeek
*/
it
(
"
testReminderRequestType002
"
,
0
,
async
function
(
done
)
{
console
.
log
(
'
----------------------testReminderRequestType002---------------------------
'
);
let
alarm
=
{
reminderType
:
reminderAgent
.
ReminderType
.
REMINDER_TYPE_ALARM
,
reminderRequestAlarm
:
{
hour
:
7
,
minute
:
10
,
daysOfWeek
:
[
1
,
2
,
3
,
4
,
5
]
}
}
reminderAgent
.
publishReminder
(
alarm
).
then
((
reminderId
)
=>
{
console
.
log
(
"
reminderId =
"
+
reminderId
);
});
setTimeout
(()
=>
{
done
();
},
500
);
})
})
resourceschedule/resourceschedule_standard/workscheduler/src/main/js/default/test/WorkScheduler.test.js
浏览文件 @
2e936e64
...
...
@@ -850,7 +850,7 @@ describe("WorkSchedulerJsTest", function () {
})
/*
* @tc.name: WorkSchedulerJsTest044
* @tc.name: WorkSchedulerJsTest044
* @tc.desc: test work scheduler without conditions.
* @tc.type: FUNC
* @tc.require:
...
...
@@ -904,8 +904,8 @@ describe("WorkSchedulerJsTest", function () {
networkType
:
NETWORK_TYPE_ANY
}
let
res
=
workScheduler
.
startWork
(
workInfo
);
expect
(
res
).
assertEqual
(
tru
e
);
console
.
info
(
"
workSchedulerLog workInfo networkType :
"
+
workInfo
.
networkType
)
expect
(
res
).
assertEqual
(
fals
e
);
console
.
info
(
"
workSchedulerLog workInfo networkType :
"
+
workInfo
.
networkType
)
;
done
();
})
...
...
@@ -924,8 +924,8 @@ describe("WorkSchedulerJsTest", function () {
chargerType
:
workScheduler
.
ChargingType
.
CHARGING_PLUGGED_AC
}
let
res
=
workScheduler
.
startWork
(
workInfo
);
expect
(
res
).
assertEqual
(
tru
e
);
console
.
info
(
"
workSchedulerLog workInfo ChargingType :
"
+
workScheduler
.
ChargingType
.
CHARGING_PLUGGED_AC
)
expect
(
res
).
assertEqual
(
fals
e
);
console
.
info
(
"
workSchedulerLog workInfo ChargingType :
"
+
workScheduler
.
ChargingType
.
CHARGING_PLUGGED_AC
)
;
done
();
})
...
...
@@ -944,8 +944,8 @@ describe("WorkSchedulerJsTest", function () {
batteryStatus
:
workScheduler
.
BatteryStatus
.
BATTERY_STATUS_LOW
}
let
res
=
workScheduler
.
startWork
(
workInfo
);
expect
(
res
).
assertEqual
(
tru
e
);
console
.
info
(
"
workSchedulerLog workInfo BatteryStatus :
"
+
workScheduler
.
BatteryStatus
.
BATTERY_STATUS_LOW
)
expect
(
res
).
assertEqual
(
fals
e
);
console
.
info
(
"
workSchedulerLog workInfo BatteryStatus :
"
+
workScheduler
.
BatteryStatus
.
BATTERY_STATUS_LOW
)
;
done
();
})
...
...
@@ -962,8 +962,8 @@ describe("WorkSchedulerJsTest", function () {
bundleName
:
"
ohos.acts.resourceschedule.workscheduler.js.function
"
,
abilityName
:
"
com.mytest.abilityName
"
,
}
let
res
=
workScheduler
.
onWorkStart
(
workInfo
);
expect
(
res
).
assertEqual
(
tru
e
);
var
res
=
workScheduler
.
onWorkStart
(
workInfo
);
expect
(
res
).
assertEqual
(
fals
e
);
done
();
})
...
...
@@ -980,13 +980,8 @@ describe("WorkSchedulerJsTest", function () {
bundleName
:
"
ohos.acts.resourceschedule.workscheduler.js.function
"
,
abilityName
:
"
com.mytest.abilityName
"
,
}
let
res
=
workSchedulerCallback
.
onWorkStop
(
workInfo
);
if
(
res
===
true
)
{
let
stopRes
=
WorkSchedulerCallback
.
onWorkStop
(
workInfo
,
false
);
expect
(
stopRes
).
assertEqual
(
true
);
}
else
{
expect
(
false
).
assertEqual
(
true
);
}
var
stopRes
=
workSchedulerCallback
.
onWorkStop
(
workInfo
,
true
);
expect
(
stopRes
).
assertEqual
(
false
);
done
();
})
...
...
@@ -1004,8 +999,8 @@ describe("WorkSchedulerJsTest", function () {
abilityName
:
"
com.mytest.abilityName
"
,
}
var
res
=
workScheduler
.
startWork
(
workInfo
);
expect
(
res
).
assertEqual
(
tru
e
);
console
.
log
(
"
workScheduler workInfo bundleName :
"
+
info
.
bundleName
)
expect
(
res
).
assertEqual
(
fals
e
);
console
.
log
(
"
workScheduler workInfo bundleName :
"
+
workInfo
.
bundleName
);
done
();
})
...
...
@@ -1018,13 +1013,13 @@ describe("WorkSchedulerJsTest", function () {
it
(
"
WorkSchedulerJsTest052
"
,
0
,
async
function
(
done
)
{
console
.
info
(
'
----------------------WorkSchedulerJsTest052---------------------------
'
);
let
workInfo
=
{
workId
:
4
,
workId
:
8
,
bundleName
:
"
ohos.acts.resourceschedule.workscheduler.js.function
"
,
abilityName
:
"
com.mytest.abilityName
"
,
}
var
res
=
workScheduler
.
startWork
(
workInfo
);
expect
(
res
).
assertEqual
(
tru
e
);
console
.
log
(
"
workScheduler workInfo abilityName :
"
+
info
.
abilityName
)
expect
(
res
).
assertEqual
(
fals
e
);
console
.
log
(
"
test workScheduler workInfo abilityName :
"
+
workInfo
.
abilityName
);
done
();
})
})
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录