diff --git a/function/notification/build-profile.json5 b/function/notification/build-profile.json5 index b1ea9297e220f253a0ed96cf45cb2f8129f1a021..4d8153c8a6d7a27b9c2393c5fdd920598839c9e4 100644 --- a/function/notification/build-profile.json5 +++ b/function/notification/build-profile.json5 @@ -15,8 +15,6 @@ { "app": { - "signingConfigs": [ - ], "products": [ { "name": "default", diff --git a/function/notification/entry/src/ohosTest/ets/test/Ability.test.ets b/function/notification/entry/src/ohosTest/ets/test/Ability.test.ets deleted file mode 100644 index 24cdb34168ced2495dce26bf5079983515702855..0000000000000000000000000000000000000000 --- a/function/notification/entry/src/ohosTest/ets/test/Ability.test.ets +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2023 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 hilog from '@ohos.hilog'; -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; - -export default function abilityTest() { - describe('ActsAbilityTest', () => { - // Defines a test suite. Two parameters are supported: test suite name and test suite function. - beforeAll(() => { - // Presets an action, which is performed only once before all test cases of the test suite start. - // This API supports only one parameter: preset action function. - }) - beforeEach(() => { - // Presets an action, which is performed before each unit test case starts. - // The number of execution times is the same as the number of test cases defined by **it**. - // This API supports only one parameter: preset action function. - }) - afterEach(() => { - // Presets a clear action, which is performed after each unit test case ends. - // The number of execution times is the same as the number of test cases defined by **it**. - // This API supports only one parameter: clear action function. - }) - afterAll(() => { - // Presets a clear action, which is performed after all test cases of the test suite end. - // This API supports only one parameter: clear action function. - }) - it('assertContain', 0, () => { - // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. - hilog.info(0x0000, 'testTag', '%{public}s', 'it begin'); - let a = 'abc'; - let b = 'b'; - // Defines a variety of assertion methods, which are used to declare expected boolean conditions. - expect(a).assertContain(b); - expect(a).assertEqual(a); - }) - }) -} \ No newline at end of file diff --git a/function/notification/entry/src/ohosTest/ets/test/List.test.ets b/function/notification/entry/src/ohosTest/ets/test/List.test.ets index 657d194164f932396390ddb56c59cbd65c7d1259..184256daa77a0d0b5513554db3ef7498746faae7 100644 --- a/function/notification/entry/src/ohosTest/ets/test/List.test.ets +++ b/function/notification/entry/src/ohosTest/ets/test/List.test.ets @@ -13,7 +13,7 @@ * limitations under the License. */ -import abilityTest from './Ability.test'; +import abilityTest from './notificationManagerTest.test'; export default function testsuite() { abilityTest(); diff --git a/function/notification/entry/src/ohosTest/ets/test/notificationManagerTest.test.ets b/function/notification/entry/src/ohosTest/ets/test/notificationManagerTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..48aba29f108904a07218401296a562f54c75b68f --- /dev/null +++ b/function/notification/entry/src/ohosTest/ets/test/notificationManagerTest.test.ets @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2023 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 hilog from '@ohos.hilog'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; +import Base from '@ohos.base'; +import notificationManager from '@ohos.notificationManager'; + +export default function abilityTest() { + describe('ActsAbilityTest', () => { + + /* + * @tc.number Sub_Notification_Ans_NoDistrub_Repetition_0200 + * @tc.name Sub_Notification_Ans_NoDistrub_Repetition_0200 + */ + it('Sub_Notification_Ans_NoDistrub_Repetition_0200', 3, () => { + hilog.info(0x0001, 'test1', '%{public}s', 'appMessageId it begin'); + + let notificationRequest: notificationManager.NotificationRequest = { + id: 1, + content: { + notificationContentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + } + }, + appMessageId:undefined + }; + + try{ + notificationManager.publish(notificationRequest) + .then(() => { + hilog.info(0x0001, 'MyTest', '%{public}s', "appMessageId success, data: void"/* + JSON.stringify(data)*/); + expect().assertFail() + }) + } + catch(err){ + hilog.info(0x0001, 'MyTest', '%{public}s', `appMessageId fail! code: ${err.code}, message: ${err.message}`); + expect(err.code).assertEqual(401); + } + + hilog.info(0x0001, 'test1', '%{public}s', 'appMessageId it end'); + }) + + /* + * @tc.number Sub_Notification_Ans_NoDistrub_Repetition_0500 + * @tc.name Sub_Notification_Ans_NoDistrub_Repetition_0500 + */ + it('Sub_Notification_Ans_NoDistrub_Repetition_0500', 3, () => { + hilog.info(0x0001, 'test1', '%{public}s', 'unifiedGroupInfo it begin'); + + let notificationRequest: notificationManager.NotificationRequest = { + id: 1, + content: { + notificationContentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, + normal: { + title: "test_title", + text: "test_text", + additionalText: "test_additionalText" + } + }, + unifiedGroupInfo:undefined + }; + + try{ + notificationManager.publish(notificationRequest) + .then(() => { + hilog.info(0x0001, 'MyTest', '%{public}s', "unifiedGroupInfo success, data: void"/* + JSON.stringify(data)*/); + expect().assertFail() + }) + } + catch(err){ + hilog.info(0x0001, 'MyTest', '%{public}s', `unifiedGroupInfo fail! code: ${err.code}, message: ${err.message}`); + expect(err.code).assertEqual(401); + } + + hilog.info(0x0001, 'test1', '%{public}s', 'unifiedGroupInfo it end'); + }) + + }) +} \ No newline at end of file diff --git a/function/notification/entry/src/ohosTest/module.json5 b/function/notification/entry/src/ohosTest/module.json5 index 10f04ece96ba66615dada762c7a98a459038a6b5..34c979039409bbc439b92b866374890982b0e4df 100644 --- a/function/notification/entry/src/ohosTest/module.json5 +++ b/function/notification/entry/src/ohosTest/module.json5 @@ -1,10 +1,10 @@ -/** - * Copyright (c) 2024 Shenzhen Kaihong Digital Industry Development Co., Ltd. +/* + * Copyright (c) 2023 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 + * 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, @@ -26,6 +26,16 @@ "deliveryWithInstall": true, "installationFree": false, "pages": "$profile:test_pages", + + "requestPermissions": [ + { + "name":"ohos.permission.OHOS_PERMISSION_NOTIFICATION_AGENT_CONTROLLER" + }, + { + "name":"ohos.permission.NOTIFICATION_CONTROLLER" + } + ], + "abilities": [ { "name": "TestAbility", diff --git a/function/ui_compare/uicompare/entry/src/ohosTest/ets/test/model/Settings.ets b/function/ui_compare/uicompare/entry/src/ohosTest/ets/test/model/Settings.ets index f64d2304cd079532ed1c0c80fbf29af9ef301ea9..3b86eb4070ab6f35e4a810ed187239dfc4ea83c2 100644 --- a/function/ui_compare/uicompare/entry/src/ohosTest/ets/test/model/Settings.ets +++ b/function/ui_compare/uicompare/entry/src/ohosTest/ets/test/model/Settings.ets @@ -146,19 +146,19 @@ class Settings { this.windowCreateType = "createWindow" if (X == undefined) { - X = 10; + X = 0; } if (Y == undefined) { - Y = 200; + Y = 60; } if (width == undefined) { - width = 1000; + width = 720; } if (height == undefined) { - height = 1000; + height = 1220; } if (dpi == undefined) { - dpi = 400; + dpi = 290; } Logger.info(TAG, `params,pageURI=${pageURI},X=${X},Y=${Y},width=${width},height=${height},dpi=${dpi}`) this.changeDpi(dpi) @@ -213,7 +213,6 @@ class Settings { await sleep(200) this.setWindowSystemBarEnable(this.windowClass, []); }); - } }