From ce00258aa60641602877e8bd41fc08e213f3106e Mon Sep 17 00:00:00 2001 From: zhijianwen Date: Tue, 8 Nov 2022 15:08:19 +0800 Subject: [PATCH] --add-- Signed-off-by: zhijianwen --- .../test/ActsNotificationManagerSlotTest.js | 155 +++++++----------- ...otificationSecondaryDirectoryTest.test.ets | 5 + .../main/js/test/ActsNotificationSlotTest.js | 144 +++++++--------- 3 files changed, 127 insertions(+), 177 deletions(-) diff --git a/notification/ans_standard/actsNotificationManagerSlotTest/src/main/js/test/ActsNotificationManagerSlotTest.js b/notification/ans_standard/actsNotificationManagerSlotTest/src/main/js/test/ActsNotificationManagerSlotTest.js index 81e60d943..46ec45303 100644 --- a/notification/ans_standard/actsNotificationManagerSlotTest/src/main/js/test/ActsNotificationManagerSlotTest.js +++ b/notification/ans_standard/actsNotificationManagerSlotTest/src/main/js/test/ActsNotificationManagerSlotTest.js @@ -751,7 +751,7 @@ export default function ActsNotificationManagerSlotTest() { }) try { - await notificationManager.getSlot(notificationManager.SlotType.UNKNOWN_TYPE, (err, NotificationSlot) => { + notificationManager.getSlot(notificationManager.SlotType.UNKNOWN_TYPE, (err, NotificationSlot) => { if (err) { console.info(`${TAG} getSlot UNKNOWN_TYPE errCode: ${err.code}, errMes: ${err.message}`) expect(false).assertTrue() @@ -759,6 +759,17 @@ export default function ActsNotificationManagerSlotTest() { } else { console.info(`${TAG} getSlot UNKNOWN_TYPE success: ${NotificationSlot.type}`) expect(true).assertTrue() + notificationManager.removeSlot(notificationManager.SlotType.UNKNOWN_TYPE, (err) => { + if (err) { + console.info(`${TAG} removeSlot UNKNOWN_TYPE errCode: ${err.code}, errMes: ${err.message}`) + expect(false).assertTrue() + done() + } else { + console.info(`${TAG} removeSlot UNKNOWN_TYPE success`) + expect(true).assertTrue() + done() + } + }) done() } }) @@ -768,24 +779,6 @@ export default function ActsNotificationManagerSlotTest() { done() } - try { - await notificationManager.removeSlot(notificationManager.SlotType.UNKNOWN_TYPE, (err) => { - if (err) { - console.info(`${TAG} removeSlot UNKNOWN_TYPE errCode: ${err.code}, errMes: ${err.message}`) - expect(false).assertTrue() - done() - } else { - console.info(`${TAG} removeSlot UNKNOWN_TYPE success`) - expect(true).assertTrue() - done() - } - }) - } catch (err) { - console.info(`${TAG} removeSlot UNKNOWN_TYPE errCode: ${err.code}, errMes: ${err.message}`) - expect(false).assertTrue() - done() - } - console.info(TAG + 'SUB_NOTIFICATION_ANS_MANAGER_SLOT_TEST_3100 END') }) @@ -808,7 +801,7 @@ export default function ActsNotificationManagerSlotTest() { }) try { - await notificationManager.getSlot(notificationManager.SlotType.SOCIAL_COMMUNICATION, (err, NotificationSlot) => { + notificationManager.getSlot(notificationManager.SlotType.SOCIAL_COMMUNICATION, (err, NotificationSlot) => { if (err) { console.info(`${TAG} getSlot SOCIAL_COMMUNICATION errCode: ${err.code}, errMes: ${err.message}`) expect(false).assertTrue() @@ -816,6 +809,17 @@ export default function ActsNotificationManagerSlotTest() { } else { console.info(`${TAG} getSlot SOCIAL_COMMUNICATION success: ${NotificationSlot.type}`) expect(true).assertTrue() + notificationManager.removeSlot(notificationManager.SlotType.SOCIAL_COMMUNICATION, (err) => { + if (err) { + console.info(`${TAG} removeSlot SOCIAL_COMMUNICATION errCode: ${err.code}, errMes: ${err.message}`) + expect(false).assertTrue() + done() + } else { + console.info(`${TAG} removeSlot SOCIAL_COMMUNICATION success`) + expect(true).assertTrue() + done() + } + }) done() } }) @@ -825,24 +829,6 @@ export default function ActsNotificationManagerSlotTest() { done() } - try { - await notificationManager.removeSlot(notificationManager.SlotType.SOCIAL_COMMUNICATION, (err) => { - if (err) { - console.info(`${TAG} removeSlot SOCIAL_COMMUNICATION errCode: ${err.code}, errMes: ${err.message}`) - expect(false).assertTrue() - done() - } else { - console.info(`${TAG} removeSlot SOCIAL_COMMUNICATION success`) - expect(true).assertTrue() - done() - } - }) - } catch (err) { - console.info(`${TAG} removeSlot SOCIAL_COMMUNICATION errCode: ${err.code}, errMes: ${err.message}`) - expect(false).assertTrue() - done() - } - console.info(TAG + 'SUB_NOTIFICATION_ANS_MANAGER_SLOT_TEST_3200 END') }) @@ -865,7 +851,7 @@ export default function ActsNotificationManagerSlotTest() { }) try { - await notificationManager.getSlot(notificationManager.SlotType.SERVICE_INFORMATION, (err, NotificationSlot) => { + notificationManager.getSlot(notificationManager.SlotType.SERVICE_INFORMATION, (err, NotificationSlot) => { if (err) { console.info(`${TAG} getSlot SERVICE_INFORMATION errCode: ${err.code}, errMes: ${err.message}`) expect(false).assertTrue() @@ -873,6 +859,17 @@ export default function ActsNotificationManagerSlotTest() { } else { console.info(`${TAG} getSlot SERVICE_INFORMATION success: ${NotificationSlot.type}`) expect(true).assertTrue() + notificationManager.removeSlot(notificationManager.SlotType.SERVICE_INFORMATION, (err) => { + if (err) { + console.info(`${TAG} removeSlot SERVICE_INFORMATION errCode: ${err.code}, errMes: ${err.message}`) + expect(false).assertTrue() + done() + } else { + console.info(`${TAG} removeSlot SERVICE_INFORMATION success`) + expect(true).assertTrue() + done() + } + }) done() } }) @@ -882,24 +879,6 @@ export default function ActsNotificationManagerSlotTest() { done() } - try { - await notificationManager.removeSlot(notificationManager.SlotType.SERVICE_INFORMATION, (err) => { - if (err) { - console.info(`${TAG} removeSlot SERVICE_INFORMATION errCode: ${err.code}, errMes: ${err.message}`) - expect(false).assertTrue() - done() - } else { - console.info(`${TAG} removeSlot SERVICE_INFORMATION success`) - expect(true).assertTrue() - done() - } - }) - } catch (err) { - console.info(`${TAG} removeSlot SERVICE_INFORMATION errCode: ${err.code}, errMes: ${err.message}`) - expect(false).assertTrue() - done() - } - console.info(TAG + 'SUB_NOTIFICATION_ANS_MANAGER_SLOT_TEST_3300 END') }) @@ -922,7 +901,7 @@ export default function ActsNotificationManagerSlotTest() { }) try { - await notificationManager.getSlot(notificationManager.SlotType.CONTENT_INFORMATION, (err, NotificationSlot) => { + notificationManager.getSlot(notificationManager.SlotType.CONTENT_INFORMATION, (err, NotificationSlot) => { if (err) { console.info(`${TAG} getSlot CONTENT_INFORMATION errCode: ${err.code}, errMes: ${err.message}`) expect(false).assertTrue() @@ -930,6 +909,17 @@ export default function ActsNotificationManagerSlotTest() { } else { console.info(`${TAG} getSlot CONTENT_INFORMATION success: ${NotificationSlot.type}`) expect(true).assertTrue() + notificationManager.removeSlot(notificationManager.SlotType.CONTENT_INFORMATION, (err) => { + if (err) { + console.info(`${TAG} removeSlot CONTENT_INFORMATION errCode: ${err.code}, errMes: ${err.message}`) + expect(false).assertTrue() + done() + } else { + console.info(`${TAG} removeSlot CONTENT_INFORMATION success`) + expect(true).assertTrue() + done() + } + }) done() } }) @@ -939,24 +929,6 @@ export default function ActsNotificationManagerSlotTest() { done() } - try { - await notificationManager.removeSlot(notificationManager.SlotType.CONTENT_INFORMATION, (err) => { - if (err) { - console.info(`${TAG} removeSlot CONTENT_INFORMATION errCode: ${err.code}, errMes: ${err.message}`) - expect(false).assertTrue() - done() - } else { - console.info(`${TAG} removeSlot CONTENT_INFORMATION success`) - expect(true).assertTrue() - done() - } - }) - } catch (err) { - console.info(`${TAG} removeSlot CONTENT_INFORMATION errCode: ${err.code}, errMes: ${err.message}`) - expect(false).assertTrue() - done() - } - console.info(TAG + 'SUB_NOTIFICATION_ANS_MANAGER_SLOT_TEST_3400 END') }) @@ -979,7 +951,7 @@ export default function ActsNotificationManagerSlotTest() { }) try { - await notificationManager.getSlot(notificationManager.SlotType.OTHER_TYPES, (err, NotificationSlot) => { + notificationManager.getSlot(notificationManager.SlotType.OTHER_TYPES, (err, NotificationSlot) => { if (err) { console.info(`${TAG} getSlot OTHER_TYPES errCode: ${err.code}, errMes: ${err.message}`) expect(false).assertTrue() @@ -987,6 +959,17 @@ export default function ActsNotificationManagerSlotTest() { } else { console.info(`${TAG} getSlot OTHER_TYPES success: ${NotificationSlot.type}`) expect(true).assertTrue() + notificationManager.removeSlot(notificationManager.SlotType.OTHER_TYPES, (err) => { + if (err) { + console.info(`${TAG} removeSlot OTHER_TYPES errCode: ${err.code}, errMes: ${err.message}`) + expect(false).assertTrue() + done() + } else { + console.info(`${TAG} removeSlot OTHER_TYPES success`) + expect(true).assertTrue() + done() + } + }) done() } }) @@ -996,24 +979,6 @@ export default function ActsNotificationManagerSlotTest() { done() } - try { - await notificationManager.removeSlot(notificationManager.SlotType.OTHER_TYPES, (err) => { - if (err) { - console.info(`${TAG} removeSlot OTHER_TYPES errCode: ${err.code}, errMes: ${err.message}`) - expect(false).assertTrue() - done() - } else { - console.info(`${TAG} removeSlot OTHER_TYPES success`) - expect(true).assertTrue() - done() - } - }) - } catch (err) { - console.info(`${TAG} removeSlot OTHER_TYPES errCode: ${err.code}, errMes: ${err.message}`) - expect(false).assertTrue() - done() - } - console.info(TAG + 'SUB_NOTIFICATION_ANS_MANAGER_SLOT_TEST_3500 END') }) diff --git a/notification/ans_standard/actsNotificationSecondaryDirectoryTest/entry/src/main/ets/test/ActsNotificationSecondaryDirectoryTest.test.ets b/notification/ans_standard/actsNotificationSecondaryDirectoryTest/entry/src/main/ets/test/ActsNotificationSecondaryDirectoryTest.test.ets index 5bdd68557..71cba91e2 100644 --- a/notification/ans_standard/actsNotificationSecondaryDirectoryTest/entry/src/main/ets/test/ActsNotificationSecondaryDirectoryTest.test.ets +++ b/notification/ans_standard/actsNotificationSecondaryDirectoryTest/entry/src/main/ets/test/ActsNotificationSecondaryDirectoryTest.test.ets @@ -544,6 +544,11 @@ describe('SUB_NOTIFICATION_ANS_SECONDARY_DIRECTORY_TEST', function () { expect(typeof flags.vibrationEnabled == 'number').assertTrue() expect(flags.soundEnabled).assertEqual(1) expect(flags.vibrationEnabled).assertEqual(2) + expect(notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT).assertEqual(0) + expect(notificationManager.ContentType.NOTIFICATION_CONTENT_LONG_TEXT).assertEqual(1) + expect(notificationManager.ContentType.NOTIFICATION_CONTENT_PICTURE).assertEqual(2) + expect(notificationManager.ContentType.NOTIFICATION_CONTENT_CONVERSATION).assertEqual(3) + expect(notificationManager.ContentType.NOTIFICATION_CONTENT_MULTILINE).assertEqual(4) done() console.info(`${TAG} SUB_NOTIFICATION_ANS_SECONDARY_DIRECTORY_TEST_1100 END`); }); diff --git a/notification/ans_standard/actsNotificationSlotTest/src/main/js/test/ActsNotificationSlotTest.js b/notification/ans_standard/actsNotificationSlotTest/src/main/js/test/ActsNotificationSlotTest.js index d286371aa..3fbed13d2 100644 --- a/notification/ans_standard/actsNotificationSlotTest/src/main/js/test/ActsNotificationSlotTest.js +++ b/notification/ans_standard/actsNotificationSlotTest/src/main/js/test/ActsNotificationSlotTest.js @@ -654,7 +654,7 @@ export default function ActsNotificationSlotTest() { done() }) - await notification.getSlot(notification.SlotType.UNKNOWN_TYPE, (err, NotificationSlot) => { + notification.getSlot(notification.SlotType.UNKNOWN_TYPE, (err, NotificationSlot) => { if (err.code) { console.info(`${TAG} getSlot UNKNOWN_TYPE err: ${err.code}`) expect(false).assertTrue() @@ -662,21 +662,21 @@ export default function ActsNotificationSlotTest() { } else { console.info(`${TAG} getSlot UNKNOWN_TYPE success: ${NotificationSlot.type}`) expect(true).assertTrue() + notification.removeSlot(notification.SlotType.UNKNOWN_TYPE, (err) => { + if (err.code) { + console.info(`${TAG} removeSlot UNKNOWN_TYPE err: ${err.code}`) + expect(false).assertTrue() + done() + } else { + console.info(`${TAG} removeSlot UNKNOWN_TYPE success`) + expect(true).assertTrue() + done() + } + }) done() } }) - await notification.removeSlot(notification.SlotType.UNKNOWN_TYPE, (err) => { - if (err.code) { - console.info(`${TAG} removeSlot UNKNOWN_TYPE err: ${err.code}`) - expect(false).assertTrue() - done() - } else { - console.info(`${TAG} removeSlot UNKNOWN_TYPE success`) - expect(true).assertTrue() - done() - } - }) console.info(TAG + 'SUB_NOTIFICATION_ANS_SLOT_TEST_3100 END') }) @@ -698,7 +698,7 @@ export default function ActsNotificationSlotTest() { done() }) - await notification.getSlot(notification.SlotType.SOCIAL_COMMUNICATION, (err, NotificationSlot) => { + notification.getSlot(notification.SlotType.SOCIAL_COMMUNICATION, (err, NotificationSlot) => { if (err.code) { console.info(`${TAG} getSlot SOCIAL_COMMUNICATION err: ${err.code}`) expect(false).assertTrue() @@ -706,21 +706,21 @@ export default function ActsNotificationSlotTest() { } else { console.info(`${TAG} getSlot SOCIAL_COMMUNICATION success: ${NotificationSlot.type}`) expect(true).assertTrue() + notification.removeSlot(notification.SlotType.SOCIAL_COMMUNICATION, (err) => { + if (err.code) { + console.info(`${TAG} removeSlot SOCIAL_COMMUNICATION err: ${err.code}`) + expect(false).assertTrue() + done() + } else { + console.info(`${TAG} removeSlot SOCIAL_COMMUNICATION success`) + expect(true).assertTrue() + done() + } + }) done() } }) - await notification.removeSlot(notification.SlotType.SOCIAL_COMMUNICATION, (err) => { - if (err.code) { - console.info(`${TAG} removeSlot SOCIAL_COMMUNICATION err: ${err.code}`) - expect(false).assertTrue() - done() - } else { - console.info(`${TAG} removeSlot SOCIAL_COMMUNICATION success`) - expect(true).assertTrue() - done() - } - }) console.info(TAG + 'SUB_NOTIFICATION_ANS_SLOT_TEST_3200 END') }) @@ -742,7 +742,7 @@ export default function ActsNotificationSlotTest() { done() }) - await notification.getSlot(notification.SlotType.SERVICE_INFORMATION, (err, NotificationSlot) => { + notification.getSlot(notification.SlotType.SERVICE_INFORMATION, (err, NotificationSlot) => { if (err.code) { console.info(`${TAG} getSlot SERVICE_INFORMATION err: ${err.code}`) expect(false).assertTrue() @@ -750,21 +750,21 @@ export default function ActsNotificationSlotTest() { } else { console.info(`${TAG} getSlot SERVICE_INFORMATION success: ${NotificationSlot.type}`) expect(true).assertTrue() + notification.removeSlot(notification.SlotType.SERVICE_INFORMATION, (err) => { + if (err.code) { + console.info(`${TAG} removeSlot SERVICE_INFORMATION err: ${err.code}`) + expect(false).assertTrue() + done() + } else { + console.info(`${TAG} removeSlot SERVICE_INFORMATION success`) + expect(true).assertTrue() + done() + } + }) done() } }) - await notification.removeSlot(notification.SlotType.SERVICE_INFORMATION, (err) => { - if (err.code) { - console.info(`${TAG} removeSlot SERVICE_INFORMATION err: ${err.code}`) - expect(false).assertTrue() - done() - } else { - console.info(`${TAG} removeSlot SERVICE_INFORMATION success`) - expect(true).assertTrue() - done() - } - }) console.info(TAG + 'SUB_NOTIFICATION_ANS_SLOT_TEST_3300 END') }) @@ -786,7 +786,7 @@ export default function ActsNotificationSlotTest() { done() }) - await notification.getSlot(notification.SlotType.CONTENT_INFORMATION, (err, NotificationSlot) => { + notification.getSlot(notification.SlotType.CONTENT_INFORMATION, (err, NotificationSlot) => { if (err.code) { console.info(`${TAG} getSlot CONTENT_INFORMATION err: ${err.code}`) expect(false).assertTrue() @@ -794,21 +794,22 @@ export default function ActsNotificationSlotTest() { } else { console.info(`${TAG} getSlot CONTENT_INFORMATION success: ${NotificationSlot.type}`) expect(true).assertTrue() + notification.removeSlot(notification.SlotType.CONTENT_INFORMATION, (err) => { + if (err.code) { + console.info(`${TAG} removeSlot CONTENT_INFORMATION err: ${err.code}`) + expect(false).assertTrue() + done() + } else { + console.info(`${TAG} removeSlot CONTENT_INFORMATION success`) + expect(true).assertTrue() + done() + } + }) done() } }) - await notification.removeSlot(notification.SlotType.CONTENT_INFORMATION, (err) => { - if (err.code) { - console.info(`${TAG} removeSlot CONTENT_INFORMATION err: ${err.code}`) - expect(false).assertTrue() - done() - } else { - console.info(`${TAG} removeSlot CONTENT_INFORMATION success`) - expect(true).assertTrue() - done() - } - }) + console.info(TAG + 'SUB_NOTIFICATION_ANS_SLOT_TEST_3400 END') }) @@ -830,7 +831,7 @@ export default function ActsNotificationSlotTest() { done() }) - await notification.getSlot(notification.SlotType.OTHER_TYPES, (err, NotificationSlot) => { + notification.getSlot(notification.SlotType.OTHER_TYPES, (err, NotificationSlot) => { if (err.code) { console.info(`${TAG} getSlot OTHER_TYPES err: ${err.code}`) expect(false).assertTrue() @@ -838,21 +839,22 @@ export default function ActsNotificationSlotTest() { } else { console.info(`${TAG} getSlot OTHER_TYPES success: ${NotificationSlot.type}`) expect(true).assertTrue() + notification.removeSlot(notification.SlotType.OTHER_TYPES, (err) => { + if (err.code) { + console.info(`${TAG} removeSlot CONTENT_INFORMATION err: ${err.code}`) + expect(false).assertTrue() + done() + } else { + console.info(`${TAG} removeSlot CONTENT_INFORMATION success`) + expect(true).assertTrue() + done() + } + }) done() } }) - await notification.removeSlot(notification.SlotType.OTHER_TYPES, (err) => { - if (err.code) { - console.info(`${TAG} removeSlot CONTENT_INFORMATION err: ${err.code}`) - expect(false).assertTrue() - done() - } else { - console.info(`${TAG} removeSlot CONTENT_INFORMATION success`) - expect(true).assertTrue() - done() - } - }) + console.info(TAG + 'SUB_NOTIFICATION_ANS_SLOT_TEST_3500 END') }) @@ -1207,17 +1209,6 @@ export default function ActsNotificationSlotTest() { it('SUB_NOTIFICATION_ANS_SLOT_TEST_4700', 0, async function (done) { console.info(TAG + 'SUB_NOTIFICATION_ANS_SLOT_TEST_4700 START') -// await notification.addSlot(notification.SlotType.UNKNOWN_TYPE, (err) => { -// if (err.code) { -// console.info(`${TAG} addSlot UNKNOWN_TYPE err: + ${err.code}`) -// expect(false).assertTrue() -// done() -// } else { -// console.info(`${TAG} addSlot UNKNOWN_TYPE success`) -// expect(true).assertTrue() -// } -// }) - await notification.addSlot(notification.SlotType.SOCIAL_COMMUNICATION, (err) => { if (err.code) { console.info(`${TAG} addSlot SOCIAL_COMMUNICATION err: + ${err.code}`) @@ -1288,17 +1279,6 @@ export default function ActsNotificationSlotTest() { it('SUB_NOTIFICATION_ANS_SLOT_TEST_4800', 0, async function (done) { console.info(TAG + 'SUB_NOTIFICATION_ANS_SLOT_TEST_4800 START') - // await notification.addSlot(notification.SlotType.UNKNOWN_TYPE, (err) => { - // if (err.code) { - // console.info(`${TAG} addSlot UNKNOWN_TYPE err: + ${err.code}`) - // expect(false).assertTrue() - // done() - // } else { - // console.info(`${TAG} addSlot UNKNOWN_TYPE success`) - // expect(true).assertTrue() - // } - // }) - await notification.addSlot(notification.SlotType.SOCIAL_COMMUNICATION, (err) => { if (err.code) { console.info(`${TAG} addSlot SOCIAL_COMMUNICATION err: + ${err.code}`) -- GitLab