diff --git a/notification/ans_standard/cancel_test/BUILD.gn b/notification/ans_standard/cancel_test/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..2517949dfbdc53bc84924f0aa18ec7d0ed464ba6 --- /dev/null +++ b/notification/ans_standard/cancel_test/BUILD.gn @@ -0,0 +1,19 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//build/config/ohos/rules.gni") +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("AnsNotificationTestCancel") { + test_hap_name = "AnsNotificationTestCancel" + hap_source_path = "hap/ans_signed.hap" +} diff --git a/notification/ans_standard/cancel_test/MyApplicationCancelAll/entry/src/main/config.json b/notification/ans_standard/cancel_test/MyApplicationCancelAll/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..26b5a01f21f9b47f8fb014cc1f492f4225d78d09 --- /dev/null +++ b/notification/ans_standard/cancel_test/MyApplicationCancelAll/entry/src/main/config.json @@ -0,0 +1,60 @@ +{ + "app": { + "bundleName": "com.example.cancelPublish", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.myapplication", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.example.myapplication.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/notification/ans_standard/cancel_test/MyApplicationCancelAll/entry/src/main/js/default/app.js b/notification/ans_standard/cancel_test/MyApplicationCancelAll/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..394207eb5460c4907b53b15a6d4f1a1a535916cc --- /dev/null +++ b/notification/ans_standard/cancel_test/MyApplicationCancelAll/entry/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/notification/ans_standard/cancel_test/MyApplicationCancelAll/entry/src/main/js/default/i18n/en-US.json b/notification/ans_standard/cancel_test/MyApplicationCancelAll/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/notification/ans_standard/cancel_test/MyApplicationCancelAll/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/notification/ans_standard/cancel_test/MyApplicationCancelAll/entry/src/main/js/default/i18n/zh-CN.json b/notification/ans_standard/cancel_test/MyApplicationCancelAll/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/notification/ans_standard/cancel_test/MyApplicationCancelAll/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/notification/ans_standard/cancel_test/MyApplicationCancelAll/entry/src/main/js/default/pages/index/index.css b/notification/ans_standard/cancel_test/MyApplicationCancelAll/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/notification/ans_standard/cancel_test/MyApplicationCancelAll/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/notification/ans_standard/cancel_test/MyApplicationCancelAll/entry/src/main/js/default/pages/index/index.hml b/notification/ans_standard/cancel_test/MyApplicationCancelAll/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/notification/ans_standard/cancel_test/MyApplicationCancelAll/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/notification/ans_standard/cancel_test/MyApplicationCancelAll/entry/src/main/js/default/pages/index/index.js b/notification/ans_standard/cancel_test/MyApplicationCancelAll/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..7095ebc7a28006f34bc5906f1ec15791e9d7a3c4 --- /dev/null +++ b/notification/ans_standard/cancel_test/MyApplicationCancelAll/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,38 @@ +import file from '@system.file' +import app from '@system.app' +import device from '@system.device' +import router from '@system.router' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + // const instrumentLog = new InstrumentLog({ + // 'id': 'report' + // }) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + // core.addService('report', instrumentLog) + core.init() + // core.subscribeEvent('spec', instrumentLog) + // core.subscribeEvent('suite', instrumentLog) + // core.subscribeEvent('task', instrumentLog) + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + } +} diff --git a/notification/ans_standard/cancel_test/MyApplicationCancelAll/entry/src/main/js/test/CancelAllJsunit.test.js b/notification/ans_standard/cancel_test/MyApplicationCancelAll/entry/src/main/js/test/CancelAllJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..5fdedd7a5a1ac75043f47eaf8dea387e1a8b160f --- /dev/null +++ b/notification/ans_standard/cancel_test/MyApplicationCancelAll/entry/src/main/js/test/CancelAllJsunit.test.js @@ -0,0 +1,561 @@ +/* +* Copyright (c) 2021 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import notify from '@ohos.notification' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('AnsNotificationTestCancel', function () { +console.info("===========AnsNotificationTestCancel start====================>"); + + function publishCallback_0100_1(err) { + console.info("==========================>publishCallback_0100_1 err=======================>" + JSON.stringify(err)); + } + function publishCallback_0100_2(err) { + console.info("==========================>publishCallback_0100_2 err=======================>" + JSON.stringify(err)); + } + function cancelAllCallBack_0100(err, data){ + console.info("==========================>cancelAllCallBack_0100 start=======================>"); + console.info("================>cancelAllCallBack_0100 err : =======================>" + JSON.stringify(err)); + console.info("==========================>cancelAllCallBack_0100 end=======================>"); + } + /* + * @tc.number: ANS_Cancel_0100 + * @tc.name: cancelAll(callback: AsyncCallback): void + * @tc.desc: Verify that the application successfully cancels all its published notifications by calling the cancelAll(callback: AsyncCallback) interface + */ + it('ANS_Cancel_0100', 0, async function (done) { + console.info("===============ANS_Cancel_0100 start==========================>"); + var notificationRequest = { + content:{ + contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + }, + }, + id: 1, + slotType : notify.SlotType.OTHER_TYPES, + isOngoing : true, + isUnremovable : false, + deliveryTime : 1624950453, + tapDismissed : true, + autoDeletedTime: 1625036817, + color: 2, + colorEnabled: true, + isAlertOnce: true, + isStopwatch: true, + isCountDown: true, + progressValue: 12, + progressMaxValue: 100, + isIndeterminate: true, + statusBarText: "statusBarText", + isFloatingIcon : true, + label: "0100_1", + badgeIconStyle: 1, + showDeliveryTime: true, + } + var notificationRequest1 = { + content:{ + contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + }, + }, + id: 1, + slotType : notify.SlotType.OTHER_TYPES, + isOngoing : true, + isUnremovable : false, + deliveryTime : 1624950453, + tapDismissed : true, + autoDeletedTime: 1625036817, + color: 2, + colorEnabled: true, + isAlertOnce: true, + isStopwatch: true, + isCountDown: true, + progressValue: 12, + progressMaxValue: 100, + isIndeterminate: true, + statusBarText: "statusBarText", + isFloatingIcon : true, + label: "0100_2", + badgeIconStyle: 1, + showDeliveryTime: true, + } + await notify.publish(notificationRequest, publishCallback_0100_1); + console.info("===============ANS_Cancel_0100 publish1 start==========================>"); + await notify.publish(notificationRequest1, publishCallback_0100_2); + console.info("===============ANS_Cancel_0100 publish2 start==========================>"); + await notify.cancelAll(cancelAllCallBack_0100); + console.info("===============ANS_Cancel_0100 cancelAll start==========================>"); + done(); + }) + + /* + * @tc.number: ANS_Cancel_0200 + * @tc.name: cancelAll(): Promise + * @tc.desc: Verify that the application successfully cancels all its published notifications by calling the cancelAll(): Promise interface + */ + it('ANS_Cancel_0200', 0, async function (done) { + console.info("===============ANS_Cancel_0200 start==========================>"); + var notificationRequest = { + content:{ + contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + }, + }, + id: 1, + slotType : notify.SlotType.OTHER_TYPES, + isOngoing : true, + isUnremovable : false, + deliveryTime : 1624950453, + tapDismissed : true, + autoDeletedTime: 1625036817, + color: 2, + colorEnabled: true, + isAlertOnce: true, + isStopwatch: true, + isCountDown: true, + progressValue: 12, + progressMaxValue: 100, + isIndeterminate: true, + statusBarText: "statusBarText", + isFloatingIcon : true, + label: "0100_1", + badgeIconStyle: 1, + showDeliveryTime: true, + } + var notificationRequest1 = { + content:{ + contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + }, + }, + id: 1, + slotType : notify.SlotType.OTHER_TYPES, + isOngoing : true, + isUnremovable : false, + deliveryTime : 1624950453, + tapDismissed : true, + autoDeletedTime: 1625036817, + color: 2, + colorEnabled: true, + isAlertOnce: true, + isStopwatch: true, + isCountDown: true, + progressValue: 12, + progressMaxValue: 100, + isIndeterminate: true, + statusBarText: "statusBarText", + isFloatingIcon : true, + label: "0100_2", + badgeIconStyle: 1, + showDeliveryTime: true, + } + await notify.publish(notificationRequest).then(() => { + console.info("================>publish_promise_0200 notificationRequest=======================>"); + }); + await notify.publish(notificationRequest1).then(() => { + console.info("================>publish_promise_0200 notificationRequest1=======================>"); + }); + await notify.cancelAll().then((err,data) => { + console.info("================>cancelAll_promise_0200 start=======================>"); + console.info("================>cancelAll_promise_0200 data: =======================>" + JSON.stringify(data)); + console.info("================>cancelAll_promise_0200 err: =======================>" + JSON.stringify(err)); + console.info("================>cancelAll_promise_0200 end=======================>"); + }); + done(); + }) + + function cancelAllCallBack_0300(err){ + console.info("==========================>cancelAllCallBack_0300 start=======================>"); + console.info("================>cancelAllCallBack_0300 err : =======================>" + JSON.stringify(err)); + console.info("==========================>cancelAllCallBack_0300 end=======================>"); + } + /* + * @tc.number: ANS_Cancel_0300 + * @tc.name: cancelAll(callback: AsyncCallback): void + * @tc.desc: Verify that when no notification is published, call the cancelAll(callback: AsyncCallback): void interface to delete the notification information + */ + it('ANS_Cancel_0300', 0, async function (done) { + console.info("===============ANS_Cancel_0300 start==========================>"); + await notify.cancelAll(cancelAllCallBack_0300); + console.info("===============ANS_Cancel_0300 cancelAll start==========================>"); + done(); + }) + + /* + * @tc.number: ANS_Cancel_0400 + * @tc.name: cancelAll(): Promise + * @tc.desc: Verify that when no notification is published, call the cancelAll(): Promise interface to delete the notification information + */ + it('ANS_Cancel_0400', 0, async function (done) { + console.info("===============ANS_Cancel_0400 start==========================>"); + await notify.cancelAll().then((err,data) => { + console.info("================>cancelAll_promise_0400 start=======================>"); + console.info("================>cancelAll_promise_0400 data: =======================>" + JSON.stringify(data)); + console.info("================>cancelAll_promise_0400 err: =======================>" + JSON.stringify(err)); + console.info("================>cancelAll_promise_0400 end=======================>"); + }); + done(); + }) + + function publishCallback_0500(err) { + console.info("==========================>publishCallback_0500 err=======================>" + JSON.stringify(err)); + } + function cancelAllCallBack_0500_1(err){ + console.info("==========================>cancelAllCallBack_0500_1 start=======================>"); + console.info("================>cancelAllCallBack_0500_1 err : =======================>" + JSON.stringify(err)); + console.info("==========================>cancelAllCallBack_0500_1 end=======================>"); + } + function cancelAllCallBack_0500_2(err){ + console.info("==========================>cancelAllCallBack_0500_2 start=======================>"); + console.info("================>cancelAllCallBack_0500_2 err : =======================>" + JSON.stringify(err)); + console.info("==========================>cancelAllCallBack_0500_2 end=======================>"); + } + /* + * @tc.number: ANS_Cancel_0500 + * @tc.name: cancelAll(callback: AsyncCallback): void + * @tc.desc: Verify that when the notification information is issued, call the cancelAll(callback: AsyncCallback): void interface twice to delete the notification information. + */ + it('ANS_Cancel_0500', 0, async function (done) { + console.info("===============ANS_Cancel_0500 start==========================>"); + var notificationRequest = { + content:{ + contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + }, + }, + id: 5, + slotType : notify.SlotType.OTHER_TYPES, + isOngoing : true, + isUnremovable : false, + deliveryTime : 1624950453, + tapDismissed : true, + autoDeletedTime: 1625036817, + color: 2, + colorEnabled: true, + isAlertOnce: true, + isStopwatch: true, + isCountDown: true, + progressValue: 12, + progressMaxValue: 100, + isIndeterminate: true, + statusBarText: "statusBarText", + isFloatingIcon : true, + label: "0500", + badgeIconStyle: 1, + showDeliveryTime: true, + } + await notify.publish(notificationRequest, publishCallback_0500); + console.info("===============ANS_Cancel_0500 publish start==========================>"); + await notify.cancelAll(cancelAllCallBack_0500_1); + console.info("===============ANS_Cancel_0500 cancelAll1 start==========================>"); + await notify.cancelAll(cancelAllCallBack_0500_2); + console.info("===============ANS_Cancel_0500 cancelAll2 start==========================>"); + done(); + }) + + /* + * @tc.number: ANS_Cancel_0600 + * @tc.name: cancelAll(): Promise + * @tc.desc: Verify that when the notification information is issued, call the cancelAll(): Promise interface twice to delete the notification information. + */ + it('ANS_Cancel_0600', 0, async function (done) { + console.info("===============ANS_Cancel_0600 start==========================>"); + var notificationRequest = { + content:{ + contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + }, + }, + id: 6, + slotType : notify.SlotType.OTHER_TYPES, + isOngoing : true, + isUnremovable : false, + deliveryTime : 1624950453, + tapDismissed : true, + autoDeletedTime: 1625036817, + color: 2, + colorEnabled: true, + isAlertOnce: true, + isStopwatch: true, + isCountDown: true, + progressValue: 12, + progressMaxValue: 100, + isIndeterminate: true, + statusBarText: "statusBarText", + isFloatingIcon : true, + label: "0600", + badgeIconStyle: 1, + showDeliveryTime: true, + } + await notify.publish(notificationRequest).then(() => { + console.info("================>publish_promise_0600=======================>"); + }); + await notify.cancelAll().then((err,data) => { + console.info("================>cancelAll_promise1_0600 start=======================>"); + console.info("================>cancelAll_promise1_0600 data: =======================>" + JSON.stringify(data)); + console.info("================>cancelAll_promise1_0600 err: =======================>" + JSON.stringify(err)); + console.info("================>cancelAll_promise1_0600 end=======================>"); + }); + await notify.cancelAll().then((err,data) => { + console.info("================>cancelAll_promise2_0600 start=======================>"); + console.info("================>cancelAll_promise2_0600 data: =======================>" + JSON.stringify(data)); + console.info("================>cancelAll_promise2_0600 err: =======================>" + JSON.stringify(err)); + console.info("================>cancelAll_promise2_0600 end=======================>"); + }); + done(); + }) + + function publishCallback_0700(err) { + console.info("==========================>publishCallback_0700 err=======================>" + JSON.stringify(err)); + } + function cancelAllCallBack_0700(err){ + console.info("==========================>cancelAllCallBack_0700 start=======================>"); + console.info("================>cancelAllCallBack_0700 err : =======================>" + JSON.stringify(err)); + console.info("==========================>cancelAllCallBack_0700 end=======================>"); + } + /* + * @tc.number: ANS_Cancel_0700 + * @tc.name: cancelAll(callback: AsyncCallback): void + * @tc.desc: iVerify that when the attribute isUnremovable of the published notification information is true, call the cancelAll(callback: AsyncCallback): void interface to cancel the notification information + */ + it('ANS_Cancel_0700', 0, async function (done) { + console.info("===============ANS_Cancel_0400 start==========================>"); + var notificationRequest = { + content:{ + contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + }, + }, + id: 7, + slotType : notify.SlotType.OTHER_TYPES, + isOngoing : true, + isUnremovable : true, + deliveryTime : 1624950453, + tapDismissed : true, + autoDeletedTime: 1625036817, + color: 2, + colorEnabled: true, + isAlertOnce: true, + isStopwatch: true, + isCountDown: true, + progressValue: 12, + progressMaxValue: 100, + isIndeterminate: true, + statusBarText: "statusBarText", + isFloatingIcon : true, + label: "0700", + badgeIconStyle: 1, + showDeliveryTime: true, + } + await notify.publish(notificationRequest, publishCallback_0700); + console.info("===============ANS_Cancel_0700 publish start==========================>"); + await notify.cancelAll(cancelAllCallBack_0700); + console.info("===============ANS_Cancel_0700 cancelAll start==========================>"); + done(); + }) + + /* + * @tc.number: ANS_Cancel_0800 + * @tc.name: cancelAll(): Promise + * @tc.desc: iVerify that when the attribute isUnremovable of the published notification information is true, call the cancelAll(): Promise interface to cancel the notification information + */ + it('ANS_Cancel_0800', 0, async function (done) { + console.info("===============ANS_Cancel_0800 start==========================>"); + var notificationRequest = { + content:{ + contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + }, + }, + id: 8, + slotType : notify.SlotType.OTHER_TYPES, + isOngoing : true, + isUnremovable : true, + deliveryTime : 1624950453, + tapDismissed : true, + autoDeletedTime: 1625036817, + color: 2, + colorEnabled: true, + isAlertOnce: true, + isStopwatch: true, + isCountDown: true, + progressValue: 12, + progressMaxValue: 100, + isIndeterminate: true, + statusBarText: "statusBarText", + isFloatingIcon : true, + label: "0800", + badgeIconStyle: 1, + showDeliveryTime: true, + } + await notify.publish(notificationRequest).then(() => { + console.info("================>publish_promise_0800 =======================>"); + }); + await notify.cancelAll().then((err,data) => { + console.info("================>cancelAll_promise_0800 start=======================>"); + console.info("================>cancelAll_promise_0800 data: =======================>" + JSON.stringify(data)); + console.info("================>cancelAll_promise_0800 err: =======================>" + JSON.stringify(err)); + console.info("================>cancelAll_promise_0800 end=======================>"); + }); + done(); + }) + + function publishCallback_0900_1(err) { + console.info("==========================>publishCallback_0900_1 err=======================>" + JSON.stringify(err)); + } + function cancelAllCallBack_0900_1(err){ + console.info("==========================>cancelAllCallBack_0900_1 start=======================>"); + console.info("================>cancelAllCallBack_0900_1 err : =======================>" + JSON.stringify(err)); + console.info("==========================>cancelAllCallBack_0900_1 end=======================>"); + } + function publishCallback_0900_2(err) { + console.info("==========================>publishCallback_0900_2 err=======================>" + JSON.stringify(err)); + } + function cancelAllCallBack_0900_2(err){ + console.info("==========================>cancelAllCallBack_0900_2 start=======================>"); + console.info("================>cancelAllCallBack_0900_2 err : =======================>" + JSON.stringify(err)); + console.info("==========================>cancelAllCallBack_0900_2 end=======================>"); + } + /* + * @tc.number: ANS_Cancel_0900 + * @tc.name: cancelAll(callback: AsyncCallback): void + * @tc.desc: Verification: cancel all notification information after publishing for two consecutive times + */ + it('ANS_Cancel_0900', 0, async function (done) { + console.info("===============ANS_Cancel_0900 start==========================>"); + var notificationRequest = { + content:{ + contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + }, + }, + id: 9, + slotType : notify.SlotType.OTHER_TYPES, + isOngoing : true, + isUnremovable : false, + deliveryTime : 1624950453, + tapDismissed : true, + autoDeletedTime: 1625036817, + color: 2, + colorEnabled: true, + isAlertOnce: true, + isStopwatch: true, + isCountDown: true, + progressValue: 12, + progressMaxValue: 100, + isIndeterminate: true, + statusBarText: "statusBarText", + isFloatingIcon : true, + label: "0900", + badgeIconStyle: 1, + showDeliveryTime: true, + } + await notify.publish(notificationRequest, publishCallback_0900_1); + console.info("===============ANS_Cancel_0900 publishCallback_0900_1 start==========================>"); + await notify.cancelAll(cancelAllCallBack_0900_1); + console.info("===============ANS_Cancel_0900 cancelAll1 start==========================>"); + await notify.publish(notificationRequest, publishCallback_0900_2); + console.info("===============ANS_Cancel_0900 publishCallback_0900_1 start==========================>"); + await notify.cancelAll(cancelAllCallBack_0900_2); + console.info("===============ANS_Cancel_0900 cancelAll2 start==========================>"); + done(); + }) + + /* + * @tc.number: ANS_Cancel_1000 + * @tc.name: cancelAll(callback: AsyncCallback): void + * @tc.desc: Verification: cancel all notification information after publishing for two consecutive times + */ + it('ANS_Cancel_1000', 0, async function (done) { + console.info("===============ANS_Cancel_1000 start==========================>"); + var notificationRequest = { + content:{ + contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + }, + }, + id: 10, + slotType : notify.SlotType.OTHER_TYPES, + isOngoing : true, + isUnremovable : false, + deliveryTime : 1624950453, + tapDismissed : true, + autoDeletedTime: 1625036817, + color: 2, + colorEnabled: true, + isAlertOnce: true, + isStopwatch: true, + isCountDown: true, + progressValue: 12, + progressMaxValue: 100, + isIndeterminate: true, + statusBarText: "statusBarText", + isFloatingIcon : true, + label: "1000", + badgeIconStyle: 1, + showDeliveryTime: true, + } + await notify.publish(notificationRequest).then(() => { + console.info("================>publish1_promise_1000=======================>"); + }); + await notify.cancelAll().then((err,data) => { + console.info("================>cancelAll1_promise_1000 start=======================>"); + console.info("================>cancelAll1_promise_1000 data: =======================>" + JSON.stringify(data)); + console.info("================>cancelAll1_promise_1000 err: =======================>" + JSON.stringify(err)); + console.info("================>cancelAll1_promise_1000 end=======================>"); + }); + await notify.publish(notificationRequest).then(() => { + console.info("================>publish1_promise2_1000=======================>"); + }); + await notify.cancelAll().then((err,data) => { + console.info("================>cancelAll2_promise_1000 start=======================>"); + console.info("================>cancelAll2_promise_1000 data: =======================>" + JSON.stringify(data)); + console.info("================>cancelAll2_promise_1000 err: =======================>" + JSON.stringify(err)); + console.info("================>cancelAll2_promise_1000 end=======================>"); + }); + done(); + }) + +}) \ No newline at end of file diff --git a/notification/ans_standard/cancel_test/MyApplicationCancelAll/entry/src/main/js/test/List.test.js b/notification/ans_standard/cancel_test/MyApplicationCancelAll/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..1d5b2d80eb9265d217dd55af59c5d59ea4d754db --- /dev/null +++ b/notification/ans_standard/cancel_test/MyApplicationCancelAll/entry/src/main/js/test/List.test.js @@ -0,0 +1 @@ +require('./CancelAllJsunit.test.js') \ No newline at end of file diff --git a/notification/ans_standard/cancel_test/MyApplicationCancelAll/entry/src/main/resources/base/element/string.json b/notification/ans_standard/cancel_test/MyApplicationCancelAll/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d405647b90183b99fb4e15025a9fe12c85c495d4 --- /dev/null +++ b/notification/ans_standard/cancel_test/MyApplicationCancelAll/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "MyApplication" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/cancel_test/MyApplicationCancelAll/entry/src/main/resources/base/media/icon.png b/notification/ans_standard/cancel_test/MyApplicationCancelAll/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/notification/ans_standard/cancel_test/MyApplicationCancelAll/entry/src/main/resources/base/media/icon.png differ diff --git a/notification/ans_standard/cancel_test/MyApplicationCancelAll/hap/ans_signed.hap b/notification/ans_standard/cancel_test/MyApplicationCancelAll/hap/ans_signed.hap new file mode 100644 index 0000000000000000000000000000000000000000..0a88a48f3c55da4bd3afc606cf85359ec13d363c Binary files /dev/null and b/notification/ans_standard/cancel_test/MyApplicationCancelAll/hap/ans_signed.hap differ diff --git a/notification/ans_standard/publish_test/notification-ContentType-All/entry/package.json b/notification/ans_standard/publish_test/notification-ContentType-All/entry/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/notification/ans_standard/publish_test/notification-ContentType-All/entry/package.json @@ -0,0 +1 @@ +{} diff --git a/notification/ans_standard/publish_test/notification-ContentType-All/entry/src/main/config.json b/notification/ans_standard/publish_test/notification-ContentType-All/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..162c8df537260888197b96faaa794e7d542cdd34 --- /dev/null +++ b/notification/ans_standard/publish_test/notification-ContentType-All/entry/src/main/config.json @@ -0,0 +1,61 @@ +{ + "app": { + "bundleName": "com.neu.contentType", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 5, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.test", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.example.test.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/notification-ContentType-All/entry/src/main/js/default/app.js b/notification/ans_standard/publish_test/notification-ContentType-All/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..394207eb5460c4907b53b15a6d4f1a1a535916cc --- /dev/null +++ b/notification/ans_standard/publish_test/notification-ContentType-All/entry/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/notification/ans_standard/publish_test/notification-ContentType-All/entry/src/main/js/default/i18n/en-US.json b/notification/ans_standard/publish_test/notification-ContentType-All/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/notification/ans_standard/publish_test/notification-ContentType-All/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/notification-ContentType-All/entry/src/main/js/default/i18n/zh-CN.json b/notification/ans_standard/publish_test/notification-ContentType-All/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/notification/ans_standard/publish_test/notification-ContentType-All/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/notification-ContentType-All/entry/src/main/js/default/pages/index/index.css b/notification/ans_standard/publish_test/notification-ContentType-All/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/notification/ans_standard/publish_test/notification-ContentType-All/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/notification/ans_standard/publish_test/notification-ContentType-All/entry/src/main/js/default/pages/index/index.hml b/notification/ans_standard/publish_test/notification-ContentType-All/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..aa3c315a654f57cc17e475108f24b775d5d559d1 --- /dev/null +++ b/notification/ans_standard/publish_test/notification-ContentType-All/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + contentType + +
diff --git a/notification/ans_standard/publish_test/notification-ContentType-All/entry/src/main/js/default/pages/index/index.js b/notification/ans_standard/publish_test/notification-ContentType-All/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..cea154b94b667d054ecd49307ce94c920b13f8b5 --- /dev/null +++ b/notification/ans_standard/publish_test/notification-ContentType-All/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,56 @@ +//import device from '@system.device'; +//import {Core} from 'deccjsunit/lite' +//const core = Core.getInstance() +//core.init() +//require('../../../test/List.test.js') +//core.execute() +// +//export default { +// data: { +// title: "Test" +// }, +// onInit() { +// this.title = this.$t('strings.world'); +// } +//} + +import file from '@system.file' +import app from '@system.app' +import device from '@system.device' +import router from '@system.router' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + // const instrumentLog = new InstrumentLog({ + // 'id': 'report' + // }) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + // core.addService('report', instrumentLog) + core.init() + // core.subscribeEvent('spec', instrumentLog) + // core.subscribeEvent('suite', instrumentLog) + // core.subscribeEvent('task', instrumentLog) + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/notification-ContentType-All/entry/src/main/js/test/ExampleJsunit.test.js b/notification/ans_standard/publish_test/notification-ContentType-All/entry/src/main/js/test/ExampleJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..63b9159e5f05f33cfd8dcc3870f3944fdea86449 --- /dev/null +++ b/notification/ans_standard/publish_test/notification-ContentType-All/entry/src/main/js/test/ExampleJsunit.test.js @@ -0,0 +1,869 @@ +import notification from '@ohos.notification' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('ActsNotificationTest', function () { + function publishMULTILINEContentCallback001(error){ + console.log('ActsNotificationTest ACTS_PublishMULTILINEContent_0100 asyncCallback'+JSON.stringify(error.code)) + } + function publishMULTILINEContentCallback002(error){ + console.log('ActsNotificationTest ACTS_PublishMULTILINEContent_0200 asyncCallback'+JSON.stringify(error.code)) + } + function publishMULTILINEContentCallback003(error){ + console.log('ActsNotificationTest ACTS_PublishMULTILINEContent_0300 asyncCallback'+JSON.stringify(error.code)) + } + function publishLONGContentCallback001(error){ + console.log('ActsNotificationTest ACTS_PublishLONGContent_0100 asyncCallback'+JSON.stringify(error.code)) + } + function publishLONGContentCallback002(error){ + console.log('ActsNotificationTest ACTS_PublishLONGContent_0200 asyncCallback'+JSON.stringify(error.code)) + } + function publishLONGContentCallback003(error){ + console.log('ActsNotificationTest ACTS_PublishLONGContent_0300 asyncCallback'+JSON.stringify(error.code)) + } + function publishSlotTypeContentCallback001(error){ + console.log('ActsNotificationTest ACTS_Publish_SlotTypeContent_0100 asyncCallback'+JSON.stringify(error.code)) + } + function publishSlotTypeContentCallback002(error){ + console.log('ActsNotificationTest ACTS_Publish_SlotTypeContent_0200 asyncCallback'+JSON.stringify(error.code)) + } + function publishSlotTypeContentCallback003(error){ + console.log('ActsNotificationTest ACTS_Publish_SlotTypeContent_0300 asyncCallback'+JSON.stringify(error.code)) + } + function publishSlotTypeContentCallback004(error){ + console.log('ActsNotificationTest ACTS_Publish_SlotTypeContent_0400 asyncCallback'+JSON.stringify(error.code)) + } + function publishSlotOtherCallback001(error){ + console.log('ActsNotificationTest ACTS_Publish_SlotTypeOther_0100 asyncCallback'+JSON.stringify(error.code)) + } + function publishSlotOtherCallback002(error){ + console.log('ActsNotificationTest ACTS_Publish_SlotTypeOther_0200 asyncCallback'+JSON.stringify(error.code)) + } + function publishSlotOtherCallback003(error){ + console.log('ActsNotificationTest ACTS_Publish_SlotTypeOther_0300 asyncCallback'+JSON.stringify(error.code)) + } + function publishSlotOtherCallback004(error){ + console.log('ActsNotificationTest ACTS_Publish_SlotTypeOther_0400 asyncCallback'+JSON.stringify(error.code)) + } + function publishSlotServiceCallback001(error){ + console.log('ActsNotificationTest ACTS_Publish_SlotTypeService_0100 asyncCallback'+JSON.stringify(error.code)) + } + function publishSlotServiceCallback002(error){ + console.log('ActsNotificationTest ACTS_Publish_SlotTypeService_0200 asyncCallback'+JSON.stringify(error.code)) + } + function publishSlotServiceCallback003(error){ + console.log('ActsNotificationTest ACTS_Publish_SlotTypeService_0300 asyncCallback'+JSON.stringify(error.code)) + } + function publishSlotServiceCallback004(error){ + console.log('ActsNotificationTest ACTS_Publish_SlotTypeService_0400 asyncCallback'+JSON.stringify(error.code)) + } + function publishSlotSocialCallback001(error){ + console.log('ActsNotificationTest ACTS_Publish_SlotTypeService_0400 asyncCallback'+JSON.stringify(error.code)) + } + function publishSlotSocialCallback002(error){ + console.log('ActsNotificationTest ACTS_Publish_SlotTypeService_0400 asyncCallback'+JSON.stringify(error.code)) + } + function publishSlotSocialCallback003(error){ + console.log('ActsNotificationTest ACTS_Publish_SlotTypeService_0400 asyncCallback'+JSON.stringify(error.code)) + } + function publishSlotSocialCallback004(error){ + console.log('ActsNotificationTest ACTS_Publish_SlotTypeService_0400 asyncCallback'+JSON.stringify(error.code)) + } + + /*应用侧发布本地多行类型通知*/ + it('ACTS_PublishMULTILINEContent_0100', 0,async function (done) { + try { + await notification.publish({ + Id: 1, + content: { + contentType: notification.ContentType.NOTIFICATION_CONTENT_MULTILINE, + multiLine: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText", + briefText: "briefText", + longTitle: "longTitle", + lines: ["123", "234", "345", "456"] + }, + } + }, publishMULTILINEContentCallback001); + }catch(error){ + console.log('ActsNotificationTest ACTS_PublishMULTILINEContent_0100 asyncCallback'+JSON.stringify(error.code))} + console.log("============ACTS_PublishMULTILINEContent_0100 finished============") + done(); + }) + + /*应用侧发布本地多行类型通知,不设置contentType*/ + it('ACTS_PublishMULTILINEContent_0200', 0,async function (done) { + try { + var notificationInfo = { + Id: 1, + content: { + // contentType: notification.ContentType.NOTIFICATION_CONTENT_MULTILINE, + multiLine: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText", + briefText: "briefText", + longTitle: "longTitle", + lines: ["123", "234", "345", "456"] + }, + } + } + }catch(err){ + console.log('ActsNotificationTest ACTS_PublishMULTILINEContent11111111'+err) + } + try{ + console.log('ActsNotificationTest ACTS_PublishMULTILINEContent222222222222') + await notification.publish(notificationInfo,publishMULTILINEContentCallback002); + }catch(error){ + console.log('ActsNotificationTest ACTS_PublishMULTILINEContent_0200 asyncCallback'+error) + } + console.log("============ACTS_PublishMULTILINEContent_0200 finished============") + done(); + }) + + /*应用侧发布本地多行类型通知,将contentType设置为其他类型*/ + it('ACTS_PublishMULTILINEContent_0300', 0,async function (done) { + try { + await notification.publish({ + Id: 1, + content: { + contentType: notification.ContentType.NOTIFICATION_CONTENT_PICTURE, + multiLine: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText", + briefText: "briefText", + longTitle: "longTitle", + lines: ["123", "234", "345", "456"] + }, + } + }, publishMULTILINEContentCallback003); + }catch(error){ + console.log('ActsNotificationTest ACTS_PublishMULTILINEContent_0300 asyncCallback'+JSON.stringify(error.code)) + } + console.log("============ACTS_PublishMULTILINEContent_0300 finished============") + done(); + }) + + /*应用侧发布本地多行类型通知--promise*/ + it('ACTS_PublishMULTILINEContent_0400', 0,async function (done) { + await notification.publish({ + Id: 1, + content: { + contentType: notification.ContentType.NOTIFICATION_CONTENT_MULTILINE, + multiLine: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText", + briefText:"briefText", + longTitle:"longTitle", + lines:["123","234","345","456"] + }, + } + }).then(console.log("============ACTS_PublishMULTILINEContent_0400 finished============")) + done(); + }) + + /*应用侧发布本地多行类型通知,不设置contentType--promise*/ + it('ACTS_PublishMULTILINEContent_0500', 0,async function (done) { + await notification.publish({ + Id: 1, + content: { + // contentType: notification.ContentType.NOTIFICATION_CONTENT_MULTILINE, + multiLine: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText", + briefText:"briefText", + longTitle:"longTitle", + lines:["123","234","345","456"] + }, + } + }).then(console.log("============ACTS_PublishMULTILINEContent_0500 finished============")) + done(); + }) + + /*应用侧发布本地多行类型通知,将contentType设置为其他类型*/ + it('ACTS_PublishMULTILINEContent_0600', 0,async function (done) { + await notification.publish({ + Id: 1, + content: { + contentType: notification.ContentType.NOTIFICATION_CONTENT_PICTURE, + multiLine: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText", + briefText:"briefText", + longTitle:"longTitle", + lines:["123","234","345","456"] + }, + } + }).then(console.log("============ACTS_PublishMULTILINEContent_0300 finished============")) + done(); + }) + + /*应用侧发布本地长文本通知*/ + it('ACTS_PublishLONGContent_0100', 0,async function (done) { + await notification.publish({ + Id: 1, + content: { + contentType: notification.ContentType.NOTIFICATION_CONTENT_LONG_TEXT, + longText: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText", + longText:"longText", + briefText:"briefText", + expandedTitle:"expandedTitle" + }} + },publishLONGContentCallback001); + console.log("============ACTS_PublishLONGContent_0100 finished============") + done(); + }) + + /*应用侧发布本地长文本通知,不设置contentType*/ + it('ACTS_PublishLONGContent_0200', 0,async function (done) { + await notification.publish({ + Id: 1, + content: { +// contentType: notification.ContentType.NOTIFICATION_CONTENT_LONG_TEXT, + longText: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText", + longText:"longText", + briefText:"briefText", + expandedTitle:"expandedTitle" + }} + },publishLONGContentCallback002); + console.log("============ACTS_PublishLONGContent_0200 finished============") + done(); + }) + + /*应用侧发布本地长文本通知,将contentType设置为其他类型*/ + it('ACTS_PublishLONGContent_0300', 0,async function (done) { + await notification.publish({ + Id: 1, + content: { + contentType: notification.ContentType.NOTIFICATION_CONTENT_MEDIA, + longText: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText", + longText:"longText", + briefText:"briefText", + expandedTitle:"expandedTitle" + }} + },publishLONGContentCallback003); + console.log("============ACTS_PublishLONGContent_0300 finished============") + done(); + }) + + /*应用侧发布本地长文本通知——promise*/ + it('ACTS_PublishLONGContent_0400', 0,async function (done) { + await notification.publish({ + Id: 1, + content: { + contentType: notification.ContentType.NOTIFICATION_CONTENT_LONG_TEXT, + longText: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText", + longText:"longText", + briefText:"briefText", + expandedTitle:"expandedTitle" + }} + }).then(console.log("============ACTS_PublishLONGContent_0400 finished============")) + done(); + }) + + /*应用侧发布本地长文本通知,不设置contentType*/ + it('ACTS_PublishLONGContent_0500', 0,async function (done) { + await notification.publish({ + Id: 1, + content: { + // contentType: notification.ContentType.NOTIFICATION_CONTENT_LONG_TEXT, + longText: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText", + longText:"longText", + briefText:"briefText", + expandedTitle:"expandedTitle" + }} + }).then(console.log("============ACTS_PublishLONGContent_0500 finished============")) + done(); + }) + + /*应用侧发布本地长文本通知,将contentType设置为其他类型--promise*/ + it('ACTS_PublishLONGContent_0600', 0,async function (done) { + await notification.publish({ + Id: 1, + content: { + contentType: notification.ContentType.NOTIFICATION_CONTENT_MEDIA, + longText: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText", + longText:"longText", + briefText:"briefText", + expandedTitle:"expandedTitle" + }} + }).then(console.log("============ACTS_PublishLONGContent_0600 finished============")) + done(); + }) + + /*应用侧发布本地内容资讯类型的普通文本通知*/ + it('ACTS_Publish_SlotTypeContent_0100', 0,async function (done) { + await notification.publish({ + Id: 1, + content: { + contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + } + }, + slotType:notification.SlotType.CONTENT_INFORMATION + },publishSlotTypeContentCallback001); + console.log("============ACTS_Publish_SlotTypeContent_0100 finished============") + done(); + }) + + /*应用侧发布本地内容资讯类型的普通文本通知*/ + it('ACTS_Publish_SlotTypeContent_0200', 0,async function (done) { + await notification.publish({ + Id: 1, + content: { +// contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + } + }, + slotType:notification.SlotType.CONTENT_INFORMATION + },publishSlotTypeContentCallback002); + console.log("============ACTS_Publish_SlotTypeContent_0200 finished============") + done(); + }) + + /*应用侧发布本地内容资讯类型的普通文本通知*/ + it('ACTS_Publish_SlotTypeContent_0300', 0,async function (done) { + await notification.publish({ + Id: 1, + content: { + contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + } + }, +// slotType:notification.SlotType.CONTENT_INFORMATION + },publishSlotTypeContentCallback003); + console.log("============ACTS_Publish_SlotTypeContent_0300 finished============") + done(); + }) + + /*应用侧发布本地内容资讯类型的普通文本通知*/ + it('ACTS_Publish_SlotTypeContent_0400', 0,async function (done) { + await notification.publish({ + Id: 1, + content: { + contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + } + }, + slotType:notification.SlotType.CONTENT_INFORMATION + },publishSlotTypeContentCallback004); + console.log("============ACTS_Publish_SlotTypeContent_0400 finished============") + done(); + }) + + /*应用侧发布本地内容资讯类型的普通文本通知——promise*/ + it('ACTS_Publish_SlotTypeContent_0500', 0,async function (done) { + notification.publish({ + Id: 1, + content: { + contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + } + }, + slotType:notification.SlotType.CONTENT_INFORMATION + }).then( console.log("============ACTS_Publish_SlotTypeContent_0500 finished============")) + done(); + }) + + /*应用侧发布本地内容资讯类型的普通文本通知——promise*/ + it('ACTS_Publish_SlotTypeContent_0600', 0,async function (done) { + notification.publish({ + Id: 1, + content: { + // contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + } + }, + slotType:notification.SlotType.CONTENT_INFORMATION + }).then(console.log("============ACTS_Publish_SlotTypeContent_0600 finished============")) + done(); + }) + + /*应用侧发布本地内容资讯类型的普通文本通知——promise*/ + it('ACTS_Publish_SlotTypeContent_0700', 0,async function (done) { + notification.publish({ + Id: 1, + content: { + contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + } + }, + // slotType:notification.SlotType.CONTENT_INFORMATION + }).then(console.log("============ACTS_Publish_SlotTypeContent_0700 finished============")) + done(); + }) + + /*应用侧发布本地内容资讯类型的普通文本通知——promise*/ + it('ACTS_Publish_SlotTypeContent_0800', 0,async function (done) { + notification.publish({ + Id: 1, + content: { + contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + } + }, + slotType:notification.SlotType.CONTENT_INFORMATION + }).then(console.log("============ACTS_Publish_SlotTypeContent_0800 finished============")) + done(); + }) + + /*应用侧发布本地其他类型的普通文本通知*/ + it('ACTS_PublishSlotTypeOther_0100', 0,async function (done) { + await notification.publish({ + content: { + contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + }, + slotType:notification.SlotType.OTHER_TYPES + } + },publishSlotOtherCallback001); + console.log("============ACTS_PublishSlotTypeOther_0100 finished============") + done(); + }) + + /*应用侧发布本地其他类型的普通文本通知*/ + it('ACTS_PublishSlotTypeOther_0200', 0,async function (done) { + await notification.publish({ + content: { +// contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + }, + slotType:notification.SlotType.OTHER_TYPES + } + },publishSlotOtherCallback002); + console.log("============ACTS_PublishSlotTypeOther_0200 finished============") + done(); + }) + + /*应用侧发布本地其他类型的普通文本通知*/ + it('ACTS_PublishSlotTypeOther_0300', 0,async function (done) { + await notification.publish({ + content: { + contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + }, +// slotType:notification.SlotType.OTHER_TYPES + } + },publishSlotOtherCallback003); + console.log("============ACTS_PublishSlotTypeOther_0300 finished============") + done(); + }) + + /*应用侧发布本地其他类型的普通文本通知*/ + it('ACTS_PublishSlotTypeOther_0400', 0,async function (done) { + await notification.publish({ + content: { + contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + }, + slotType:notification.SlotType.SOCIAL_COMMUNICATION + } + },publishSlotOtherCallback004); + console.log("============ACTS_PublishSlotTypeOther_0400 finished============") + done(); + }) + + /*应用侧发布本地其他类型的普通文本通知——promise*/ + it('ACTS_PublishSlotTypeOther_0500', 0,async function (done) { + notification.publish({ + content: { + contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + }, + slotType:notification.SlotType.OTHER_TYPES + } + }).then(console.log("============ACTS_PublishSlotTypeOther_0500 finished============")) + done(); + }) + + /*应用侧发布本地其他类型的普通文本通知——promise*/ + it('ACTS_PublishSlotTypeOther_0600', 0,async function (done) { + notification.publish({ + content: { + // contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + }, + slotType:notification.SlotType.OTHER_TYPES + } + }).then(console.log("============ACTS_PublishSlotTypeOther_0600 finished============")) + done(); + }) + + /*应用侧发布本地其他类型的普通文本通知———promise*/ + it('ACTS_PublishSlotTypeOther_0700', 0,async function (done) { + notification.publish({ + content: { + contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + }, + // slotType:notification.SlotType.OTHER_TYPES + } + }).then(console.log("============ACTS_PublishSlotTypeOther_0700 finished============")) + done(); + }) + + /*应用侧发布本地其他类型的普通文本通知*/ + it('ACTS_PublishSlotTypeOther_0800', 0,async function (done) { + notification.publish({ + content: { + contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + }, + slotType:notification.SlotType.SOCIAL_COMMUNICATION + } + }).then(console.log("============ACTS_PublishSlotTypeOther_0800 finished============")) + done(); + }) + + /*应用侧发布本地服务提醒类型的普通文本通知*/ + it('ACTS_PublishSlotTypeService_0100', 0,async function (done) { + await notification.publish({ + Id: 1, + content: { + contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + }, + }, + slotType:notification.SlotType.SERVICE_INFORMATION + },publishSlotServiceCallback001); + console.log("============ACTS_PublishSlotTypeService_0100 finished============") + done(); + }) + + /*应用侧发布本地服务提醒类型的普通文本通知*/ + it('ACTS_PublishSlotTypeService_0200', 0,async function (done) { + await notification.publish({ + Id: 1, + content: { +// contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + }, + }, + slotType:notification.SlotType.SERVICE_INFORMATION + },publishSlotServiceCallback002); + console.log("============ACTS_PublishSlotTypeService_0200 finished============") + done(); + }) + + /*应用侧发布本地服务提醒类型的普通文本通知*/ + it('ACTS_PublishSlotTypeService_0300', 0,async function (done) { + await notification.publish({ + Id: 1, + content: { + contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + }, + }, +// slotType:notification.SlotType.SERVICE_INFORMATION + },publishSlotServiceCallback003); + console.log("============ACTS_PublishSlotTypeService_0300 finished============") + done(); + }) + + /*应用侧发布本地服务提醒类型的普通文本通知*/ + it('ACTS_PublishSlotTypeService_0400', 0,async function (done) { + await notification.publish({ + Id: 1, + content: { + contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + }, + }, + slotType:notification.SlotType.UNKNOWN_TYPE + },publishSlotServiceCallback004); + console.log("============ACTS_PublishSlotTypeService_0400 finished============") + done(); + }) + + /*应用侧发布本地服务提醒类型的普通文本通知——promise*/ + it('ACTS_PublishSlotTypeService_0500', 0,async function (done) { + notification.publish({ + Id: 1, + content: { + contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + }, + }, + slotType:notification.SlotType.SERVICE_INFORMATION + }).then(console.log("============ACTS_PublishSlotTypeService_0500 finished============")) + done(); + }) + + /*应用侧发布本地服务提醒类型的普通文本通知——promise*/ + it('ACTS_PublishSlotTypeService_0600', 0,async function (done) { + notification.publish({ + Id: 1, + content: { + // contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + }, + }, + slotType:notification.SlotType.SERVICE_INFORMATION + }).then(console.log("============ACTS_PublishSlotTypeService_0600 finished============")) + done(); + }) + + /*应用侧发布本地服务提醒类型的普通文本通知——promise*/ + it('ACTS_PublishSlotTypeService_0700', 0,async function (done) { + notification.publish({ + Id: 1, + content: { + contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + }, + }, + // slotType:notification.SlotType.SERVICE_INFORMATION + }).then(console.log("============ACTS_PublishSlotTypeService_0700 finished============")) + done(); + }) + + /*应用侧发布本地服务提醒类型的普通文本通知——promise*/ + it('ACTS_PublishSlotTypeService_0800', 0,async function (done) { + notification.publish({ + Id: 1, + content: { + contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + }, + }, + slotType:notification.SlotType.UNKNOWN_TYPE + }).then(console.log("============ACTS_PublishSlotTypeService_0800 finished============")) + done(); + }) + + /*应用侧发布本地社交通讯类型的普通文本通知*/ + it('ACTS_PublishSlotTypeSocial_0100', 0,async function (done) { + await notification.publish({ + Id: 1, + content: { + contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + }, + slotType:notification.SlotType.SOCIAL_COMMUNICATION + } + },publishSlotSocialCallback001); + console.log("============ACTS_PublishSlotTypeSocial_0600 finished============") + done(); + }) + + /*应用侧发布本地社交通讯类型的普通文本通知*/ + it('ACTS_PublishSlotTypeSocial_0200', 0,async function (done) { + await notification.publish({ + Id: 1, + content: { +// contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + }, + slotType:notification.SlotType.SOCIAL_COMMUNICATION + } + },publishSlotSocialCallback002); + console.log("============ACTS_PublishSlotTypeSocial_0600 finished============") + done(); + }) + + /*应用侧发布本地社交通讯类型的普通文本通知*/ + it('ACTS_PublishSlotTypeSocial_0300', 0,async function (done) { + await notification.publish({ + Id: 1, + content: { + contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + }, +// slotType:notification.SlotType.SOCIAL_COMMUNICATION + } + },publishSlotSocialCallback003); + console.log("============ACTS_PublishSlotTypeSocial_0300 finished============") + done(); + }) + + /*应用侧发布本地社交通讯类型的普通文本通知*/ + it('ACTS_PublishSlotTypeSocial_0400', 0,async function (done) { + await notification.publish({ + Id: 1, + content: { + contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + }, + slotType:notification.SlotType.CONTENT_INFORMATION + } + },publishSlotSocialCallback004); + console.log("============ACTS_PublishSlotTypeSocial_0400 finished============") + done(); + }) + + /*应用侧发布本地社交通讯类型的普通文本通知——promise*/ + it('ACTS_PublishSlotTypeSocial_0500', 0,async function (done) { + notification.publish({ + Id: 1, + content: { + contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + }, + slotType:notification.SlotType.SOCIAL_COMMUNICATION + } + }).then(console.log("============ACTS_PublishSlotTypeSocial_0500 finished============")) + done(); + }) + + /*应用侧发布本地社交通讯类型的普通文本通知——promise*/ + it('ACTS_PublishSlotTypeSocial_0600', 0,async function (done) { + notification.publish({ + Id: 1, + content: { + // contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + }, + slotType:notification.SlotType.SOCIAL_COMMUNICATION + } + }).then(console.log("============ACTS_PublishSlotTypeSocial_0600 finished============")) + done(); + }) + + /*应用侧发布本地社交通讯类型的普通文本通知——promise*/ + it('ACTS_PublishSlotTypeSocial_0700', 0,async function (done) { + notification.publish({ + Id: 1, + content: { + contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + }, + // slotType:notification.SlotType.SOCIAL_COMMUNICATION + } + }).then(console.log("============ACTS_PublishSlotTypeSocial_0700 finished============")) + done(); + }) + + /*应用侧发布本地社交通讯类型的普通文本通知——promise*/ + it('ACTS_PublishSlotTypeSocial_0800', 0,async function (done) { + notification.publish({ + Id: 1, + content: { + contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + }, + slotType:notification.SlotType.CONTENT_INFORMATION + } + }).then(console.log("============ACTS_PublishSlotTypeSocial_0800 finished============")) + done(); + }) + +}) \ No newline at end of file diff --git a/notification/ans_standard/publish_test/notification-ContentType-All/entry/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/notification-ContentType-All/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..5f31c4f2a55b075ed1550ad52721c597c12624b5 --- /dev/null +++ b/notification/ans_standard/publish_test/notification-ContentType-All/entry/src/main/js/test/List.test.js @@ -0,0 +1,2 @@ +//require('./ExampleJsunit.test.js') +require('./ExampleJsunit.test.js') \ No newline at end of file diff --git a/notification/ans_standard/publish_test/notification-ContentType-All/entry/src/main/resources/base/element/string.json b/notification/ans_standard/publish_test/notification-ContentType-All/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..e95e981b01b0db8c7b3b033a7cb790815eb09abd --- /dev/null +++ b/notification/ans_standard/publish_test/notification-ContentType-All/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ContentType" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/notification-ContentType-All/entry/src/main/resources/base/media/icon.png b/notification/ans_standard/publish_test/notification-ContentType-All/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/notification/ans_standard/publish_test/notification-ContentType-All/entry/src/main/resources/base/media/icon.png differ diff --git a/notification/ans_standard/publish_test/notification-ContentType-All/hap/contentType-signed.hap b/notification/ans_standard/publish_test/notification-ContentType-All/hap/contentType-signed.hap new file mode 100644 index 0000000000000000000000000000000000000000..1f26711464e490da5f55c74dd28a4265dbf8deda Binary files /dev/null and b/notification/ans_standard/publish_test/notification-ContentType-All/hap/contentType-signed.hap differ