未验证 提交 2e936e64 编写于 作者: O openharmony_ci 提交者: Gitee

!2652 new use case

Merge pull request !2652 from 火箭龟/branch_new0318
......@@ -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);
......
......@@ -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);
})
})
......@@ -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(true);
console.info("workSchedulerLog workInfo networkType :" + workInfo.networkType)
expect(res).assertEqual(false);
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(true);
console.info("workSchedulerLog workInfo ChargingType :" + workScheduler.ChargingType.CHARGING_PLUGGED_AC)
expect(res).assertEqual(false);
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(true);
console.info("workSchedulerLog workInfo BatteryStatus :" + workScheduler.BatteryStatus.BATTERY_STATUS_LOW)
expect(res).assertEqual(false);
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(true);
var res = workScheduler.onWorkStart(workInfo);
expect(res).assertEqual(false);
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(true);
console.log("workScheduler workInfo bundleName :" + info.bundleName)
expect(res).assertEqual(false);
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(true);
console.log("workScheduler workInfo abilityName :" + info.abilityName)
expect(res).assertEqual(false);
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.
先完成此消息的编辑!
想要评论请 注册