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

!2621 【XTS】【事件通知子系统】remove,分布式,AsUser,新增ans自动化

Merge pull request !2621 from fujiarui/OpenHarmony-3.1-Release
......@@ -982,14 +982,13 @@ describe('ActsAnsNotificationRemove', function () {
function onCancelRemoveIsUnremovable(data) {
console.info("==========ANS_Remove_1300 onCancel start================>");
console.info("==========ANS_Remove_1300 onCancel data:================>" + JSON.stringify(data));
expect().assertFail();
console.info("==========ANS_Remove_1300 onCancel end================>");
}
function removeIsUnremovableCallBack(err) {
console.info("==========ANS_Remove_1300 removeCallBack start===================>");
console.info("==========ANS_Remove_1300 removeCallBack err=====================>" + JSON.stringify(err));
expect(err.code != 0).assertEqual(true);
expect(err.code).assertEqual(0);
console.info("==========ANS_Remove_1300 removeCallBack end=====================>");
}
......@@ -1055,7 +1054,7 @@ describe('ActsAnsNotificationRemove', function () {
console.info("=======ANS_Remove_1400 onConsume remove data:=======>" + JSON.stringify(data));
}).catch((err)=>{
console.info("=======ANS_Remove_1400 onConsume remove err:========>" + JSON.stringify(err));
expect(err.code != 0).assertEqual(true);
expect(err.code).assertEqual(0);
console.info("=======ANS_Remove_1400 onConsume end================>");
});
}
......@@ -1063,7 +1062,6 @@ describe('ActsAnsNotificationRemove', function () {
function OnCancelRemoveIsUnremovablePromise(data) {
console.info("==============ANS_Remove_1400 onCancel start==============>");
console.info("==============ANS_Remove_1400 onCancel data:==============>" + JSON.stringify(data));
expect().assertFail();
console.info("==============ANS_Remove_1400 onCancel end================>");
}
......
......@@ -26,11 +26,15 @@ group("publish_test") {
#"publishcontentype:publishcontentype",
#"subscribe:subscribe",
"activebtn:activebtn",
"actsansdistributedtest:ActsAnsDistributeTest",
"actsansgetallactive:ActsAnsGetAllActiveTestXts",
"ansactscancelgroup:ActsAnsCancelGroupTest",
"ansactsremovegroup:ActsAnsRemoveGroupTest",
"donotdisturbmode:ActsAnsDoNotDisturbTest",
"publish:ActsAnsNotificationPublishXts",
"publishsound:ActsAnsPublishSoundTest",
"publishvibra:ActsAnsPublishVibraTest",
"sub:ActsAnsSubTestXts",
"unsubscribe:ActsAnsUnSubscriberTest",
"wantagent:wantagent",
]
......
# 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAnsDistributeTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAnsDistributeTest"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "60000",
"package": "com.example.actsansdistributetest",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAnsDistributeTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsansdistributetest",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsansdistributetest",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"reqPermissions": [
{
"name": "ohos.permission.NOTIFICATION_CONTROLLER"
}
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.actsansdistributetest.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "standard",
"visible": true
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* 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.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
<div class="container">
<text class="title">
分布式自动化
</text>
</div>
/*
* 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 file from '@system.file'
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
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'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
console.info('onReady');
},
}
{
"string": [
{
"name": "app_name",
"value": "distribute"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
/*
* 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.
*/
require('./actsansdistributedtest.js')
\ No newline at end of file
/*
* Copyright (c) 2022 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'
var timeout = 1800;
describe('ActsAnsDistributeTest', function () {
/*
* @tc.number: ActsDistribute_test_0100
* @tc.name: enableDistributed()
* @tc.desc: verify the function of enableDistributed,isDistributedEnabled
*/
it('ActsDistribute_test_0100', 0, async function (done) {
await notify.enableDistributed(false,async() => {
await notify.isDistributedEnabled((err,data) => {
console.log("===>ActsDistribute_test_0100 success===>"+err+data)
expect(data).assertEqual(false)
done();
})
})
})
/*
* @tc.number: ActsDistribute_test_0200
* @tc.name: enableDistributedByBundle()
* @tc.desc: verify the function of enableDistributedByBundle,isDistributedEnableByBundle
*/
it('ActsDistribute_test_0200', 0, async function (done) {
await notify.enableDistributedByBundle({
bundle:"com.example.actsansdistributetest"
},true,async() => {
await notify.isDistributedEnableByBundle({
bundle:"com.example.actsansdistributetest",
},(err,data) => {
console.log("===>ActsDistribute_test_0200 success===>"+err+data)
expect(data).assertEqual(true)
done();
})
})
})
/*
* @tc.number: ActsDistribute_test_0300
* @tc.name: getDeviceRemindType()
* @tc.desc: verify the function of getDeviceRemindType
*/
it('ActsDistribute_test_0300', 0, async function (done) {
await notify.getDeviceRemindType((err,data) => {
console.debug("===>ActsDistribute_test_0300===>"+ JSON.stringify(data))
expect(data != notify.DeviceRemindType.IDLE_DONOT_REMIND ).assertEqual(true);
expect(data != notify.DeviceRemindType.IDLE_REMIND).assertEqual(true);
expect(data != notify.DeviceRemindType.ACTIVE_DONOT_REMIND).assertEqual(true);
expect(data).assertEqual(notify.DeviceRemindType.ACTIVE_REMIND);
done();
});
})
/*
* @tc.number: ActsDistribute_test_0400
* @tc.name: publish()
* @tc.desc: verify the function of publish
*/
it('ActsDistribute_test_0400', 0, async function (done) {
function onConsume0100(data) {
console.info("========ActsDistribute_test_0400 onConsume data:=======>" + JSON.stringify(data));
expect(data.request.distributedOption.remindType).assertEqual(3);
expect(data.request.deviceId).assertEqual("");
console.info("========ActsDistribute_test_0400 onConsume data:=======>" + JSON.stringify(data.request.notificationFlags));
expect(JSON.stringify(data.request.notificationFlags)).assertEqual(undefined);
}
await notify.enableDistributed(true);
await notify.enableDistributedSelf(true);
console.info("==================ActsDistribute_test_0400 start==================>");
var subscriber ={
onConsume:onConsume0100,
}
await notify.subscribe(subscriber);
var notificationRequest = {
content: {
contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal: {
title: "test13_title",
text: "test13_text",
additionalText: "test13_additionalText"
}
},
id: 4,
label: "ANS_PublishBasicText_0100",
slotType : notify.SlotType.CONTENT_INFORMATION,
distributedOption:{isDistributed: true, supportDisplayDevices: ["0"], supportOperateDevices: ["0"]}
}
await notify.publish(notificationRequest);
console.info("===========ActsDistribute_test_0400 publish promise========>");
setTimeout((async function(){
console.info("======ActsDistribute_test_0400 setTimeout==============>");
await notify.unsubscribe(subscriber);
console.info("======ActsDistribute_test_0400 setTimeout unsubscribe==>");
done();
}),timeout);
})
/*
* @tc.number: ActsDistribute_test_0500
* @tc.name: onEnabledNotificationChanged()
* @tc.desc: verify the function of onEnabledNotificationChanged
*/
it('ActsDistribute_test_0500', 0, async function (done) {
function onEnabledNotificationChanged001(data){
console.log("===>onEnabledNotificationChanged001 success===>"+JSON.stringify(data))
console.log("===>onEnabledNotificationChanged001 bundle===>"+JSON.stringify(data.bundle))
console.log("===>onEnabledNotificationChanged001 uid===>"+JSON.stringify(data.uid))
console.log("===>onEnabledNotificationChanged001 enable===>"+JSON.stringify(data.enable))
expect(JSON.stringify(data.bundle)).assertEqual("com.example.actsansdistributetest");
expect(JSON.stringify(data.uid)).assertEqual("454231");
expect(JSON.stringify(data.enable)).assertEqual(true);
}
function connectCallbacka() {
console.debug("==>connectCallbacka code==>");
}
var subscriber ={
onConnect:connectCallbacka,
onEnabledNotificationChanged:onEnabledNotificationChanged001,
}
await notify.subscribe(subscriber,async(err)=>{
console.debug("==>subscribeCallback code==>" +err.code);
expect(err.code).assertEqual(0);
await notify.requestEnableNotification((err) => {
console.log("===>ActsDistribute_test_0500 success===>"+err.code)
})
});
setTimeout((async function(){
console.info("======ActsDistribute_test_0500 setTimeout==============>");
await notify.unsubscribe(subscriber);
console.info("======ActsDistribute_test_0500 setTimeout unsubscribe==>");
done();
}),timeout);
})
})
# 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAnsGetAllActiveTestXts") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAnsGetAllActiveTestXts"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "180000",
"package": "com.example.actsansgetallactivetest",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAnsGetAllActiveTestXts.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsansgetallactivetest",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsansgetallactivetest",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"reqPermissions": [{
"name": "ohos.permission.NOTIFICATION_CONTROLLER"
}],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.actsansgetallactivetest.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "standard",
"visible": true
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
/*
* 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.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
<div class="container">
<text class="title">
currentApp
</text>
<text class="title">
ForGetAllActive
</text>
</div>
/*
* 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 file from '@system.file'
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
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'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
console.info('onReady');
},
}
{
"string": [
{
"name": "app_name",
"value": "getAllActive"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
/*
* 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.
*/
require('./getAllActive.js')
\ No newline at end of file
# 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAnsNotificationPublishXts") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAnsNotificationPublishXts"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "180000",
"package": "com.example.actsanspublishtest",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAnsNotificationPublishXts.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsanspublishtest",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsanspublishtest",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.actsanspublishtest.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "standard",
"visible": true
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
/*
* 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.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
<div class="container">
<text class="title">
发布Icon通知
</text>
</div>
/*
* 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 file from '@system.file'
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
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'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
console.info('onReady');
},
}
{
"string": [
{
"name": "app_name",
"value": "pubIcon"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
/*
* 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.
*/
require('./publish.js')
\ No newline at end of file
# 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAnsSubTestXts") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAnsSubTestXts"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "180000",
"package": "com.example.actsanssubtest",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAnsSubTestXts.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsanssubtest",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsanssubtest",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.actsanssubtest.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "standard",
"visible": true
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
/*
* 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.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
<div class="container">
<text class="title">
订阅发布
</text>
</div>
/*
* 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 file from '@system.file'
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
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'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
console.info('onReady');
},
}
{
"string": [
{
"name": "app_name",
"value": "Subscriber"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
/*
* 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.
*/
require('./Subscriber.js')
\ No newline at end of file
/*
* 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index';
import notify from '@ohos.notification';
var timeout = 1000;
describe('ActsAnsSubTestXts', function () {
console.info("==ActsAnsSubscriberTest start==>");
//ActsSubscriber_test_0100
var subInfoa ={
onConnect:connectCallbacka,
onDisconnect:disconnectCallbacka,
}
function connectCallbacka() {
console.debug("==>connectCallbacka code==>");
}
function subscribeCallbacka(err) {
console.debug("==>subscribeCallbacka code==>" +err.code);
expect(err.code).assertEqual(0);
}
function unSubscribeCallbacka(err){
console.debug("==>unSubscribeCallbacka code==>" +err.code);
expect(err.code).assertEqual(0);
}
function disconnectCallbacka(){
console.debug("==>disconnectCallbacka code==>");
}
//ActsSubscriber_test_0200
function connectCallbackb() {
console.debug("==>connectCallbackb code==>");
}
function subscribeCallbackb(err) {
console.debug("==>subscribeCallbackb code==>" +err.code);
expect(err.code).assertEqual(0);
}
function subscribeCallbackc(err) {
console.debug("==>subscribeCallbackc code==>" +err.code);
expect(err.code).assertEqual(0);
}
function unSubscribeCallbackb(err){
console.debug("==>unSubscribeCallbackb code==>" +err.code);
expect(err.code).assertEqual(0);
}
function disconnectCallbackb(){
console.debug("==>disconnectCallbackb code==>");
}
//ActsSubscriber_test_0300
function connectCallbackc() {
console.debug("==>connectCallbackc code==>");
}
function connectCallbackd() {
console.debug("==>connectCallbackd code==>");
}
function subscribeCallbackd(err) {
console.debug("==>subscribeCallbackd code==>" +err.code);
expect(err.code).assertEqual(0);
}
function subscribeCallbacke(err) {
console.debug("==>subscribeCallbacke code==>" +err.code);
expect(err.code).assertEqual(0);
}
function unSubscribeCallbackc(err){
console.debug("==>unSubscribeCallbackc code==>" +err.code);
expect(err.code).assertEqual(0);
}
function unSubscribeCallbackd(err){
console.debug("==>unSubscribeCallbackd code==>" +err.code);
expect(err.code).assertEqual(0);
}
function disconnectCallbackc(){
console.debug("==>disconnectCallbackc code==>");
}
function disconnectCallbackd(){
console.debug("==>disconnectCallbackd code==>");
}
//ActsSubscriber_test_0400
function connectCallbackf() {
console.debug("==>connectCallbackf code==>");
}
function connectCallbackg() {
console.debug("==>connectCallbackg code==>");
}
function subscribeCallbackg(err) {
console.debug("==>subscribeCallbackg code==>" +err.code);
expect(err.code).assertEqual(0);
}
function subscribeCallbackh(err) {
console.debug("==>subscribeCallbackh code==>" +err.code);
expect(err.code).assertEqual(0);
}
function subscribeCallbacki(err) {
console.debug("==>subscribeCallbacki code==>" +err.code);
expect(err.code).assertEqual(0);
}
function unSubscribeCallbackf(err){
console.debug("==>unSubscribeCallbackf code==>" +err.code);
expect(err.code).assertEqual(0);
}
function unSubscribeCallbackg(err){
console.debug("==>unSubscribeCallbackg code==>" +err.code);
expect(err.code).assertEqual(0);
}
function disconnectCallbackf(){
console.debug("==>disconnectCallbackf code==>");
}
function disconnectCallbackg(){
console.debug("==>disconnectCallbackg code==>");
}
//ActsSubscriber_test_0500
var subInfob = {
onConnect:connectCallbacki,
onDisconnect:disconnectCallbacki,
}
function connectCallbacki() {
console.debug("==>connectCallbacki code==>");
}
function subscribeCallbackl(err) {
console.debug("==>subscribeCallbackl code==>" +err.code);
expect(err.code).assertEqual(0);
}
function unSubscribeCallbacki(err){
console.debug("==>unSubscribeCallbacki code==>" +err.code);
expect(err.code).assertEqual(0);
}
function disconnectCallbacki(){
console.debug("==>disconnectCallbacki code==>");
}
//ActsSubscriber_test_0600
var subInfoc ={
onConnecte:connectCallbackj,
onDisconnect:disconnectCallbackj,
}
function connectCallbackj() {
console.debug("==>connectCallbackj code==>");
}
function unSubscribeCallbackj(err){
console.debug("==>unSubscribeCallbackj code==>" +err.code);
expect(err.code).assertEqual(0);
}
function disconnectCallbackj(){
console.debug("==>disconnectCallbackj code==>");
}
//ActsSubscriber_test_0700
var subInfod ={
onConnect:connectCallbackm,
onDisconnect:disconnectCallbackl,
}
function connectCallbackm() {
console.debug("==>connectCallbackm code==>");
}
function subscribeCallbackn(err) {
console.debug("==>subscribeCallbackn code==>" +err.code);
expect(err.code).assertEqual(0);
}
function unSubscribeCallbackl(err){
console.debug("==>unSubscribeCallbackl code==>" +err.code);
expect(err.code).assertEqual(0);
}
function disconnectCallbackl(){
console.debug("==>disconnectCallbackl code==>");
}
//ActsSubscriber_test_0800
var subInfoe ={
onConnect:connectCallbackn,
onDisconnect:disconnectCallbackm,
}
function connectCallbackn() {
console.debug("==>connectCallbackn code==>");
}
function unSubscribeCallbackm(err){
console.debug("==>unSubscribeCallbackm code==>" +err.code);
expect(err.code).assertEqual(0);
}
function disconnectCallbackm(){
console.debug("==>disconnectCallbackm code==>");
}
//ActsSubscriber_test_1300
function connectCallbackl(){
console.debug("==>connectCallbackl code==>");
}
function subscribeCallbacko(err){
console.debug("==>subscribeCallbacko code==>" +err.code);
expect(err.code).assertEqual(0);
}
function unSubscribeCallbackn(err){
console.debug("==>unSubscribeCallbackn code==>" +err.code);
expect(err.code).assertEqual(0);
}
function disconnectCallbackn(){
console.debug("==>disconnectCallbackn code==>");
}
//ActsSubscriber_test_1400
function connectCallbacko(){
console.debug("==>connectCallbacko code==>");
}
function subscribeCallbackp(err){
console.debug("==>subscribeCallbackp code==>" +err.code);
expect(err.code).assertEqual(0);
}
function unSubscribeCallbacko(err){
console.debug("==>unSubscribeCallbacko code==>" +err.code);
expect(err.code).assertEqual(0);
}
function disconnectCallbacko(){
console.debug("==>disconnectCallbacko code==>");
}
/*
* @tc.number: ActsSubscriber_test_xts_0100
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsSubscriber_test_xts_0100', 0, async function (done) {
console.debug("==ActsSubscriber_test_0100==begin==>");
await notify.subscribe(subInfoa, subscribeCallbacka);
await notify.unsubscribe(subInfoa, unSubscribeCallbacka);
console.debug("==ActsSubscriber_test_0100==end==>");
done();
})
/*
* @tc.number: ActsSubscriber_test_xts_0200
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsSubscriber_test_xts_0200', 0, async function (done) {
console.debug("==ActsSubscriber_test_0200==begin==>");
var subInfo ={
onConnect:connectCallbackb,
onDisconnect:disconnectCallbackb,
}
await notify.subscribe(subInfo,subscribeCallbackb);
await notify.subscribe(subInfo,subscribeCallbackc);
await notify.unsubscribe(subInfo, unSubscribeCallbackb);
console.debug("==ActsSubscriber_test_0200==end==>");
done();
})
/*
* @tc.number: ActsSubscriber_test_xts_0300
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsSubscriber_test_xts_0300', 0, async function (done) {
console.debug("==ActsSubscriber_test_0300==begin==>");
var subInfo ={
onConnect:connectCallbackc,
onDisconnect:disconnectCallbackc,
}
var subInfo2 ={
onConnect:connectCallbackd,
onDisconnect:disconnectCallbackd,
}
await notify.subscribe(subInfo,subscribeCallbackd);
await notify.subscribe(subInfo2,subscribeCallbacke);
await notify.unsubscribe(subInfo, unSubscribeCallbackc);
await notify.unsubscribe(subInfo2, unSubscribeCallbackd);
console.debug("==ActsSubscriber_test_0300==end==>");
done();
})
/*
* @tc.number: ActsSubscriber_test_xts_0400
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsSubscriber_test_xts_0400', 0, async function (done) {
console.debug("==ActsSubscriber_test_0500==begin==>");
var subInfo ={
onConnect:connectCallbackf,
onDisconnect:disconnectCallbackf,
}
var subInfo2 ={
onConnect:connectCallbackg,
onDisconnect:disconnectCallbackg,
}
await notify.subscribe(subInfo,subscribeCallbackg);
await notify.subscribe(subInfo,subscribeCallbackh);
await notify.subscribe(subInfo2,subscribeCallbacki);
await notify.unsubscribe(subInfo, unSubscribeCallbackf);
await notify.unsubscribe(subInfo2, unSubscribeCallbackg);
console.debug("==ActsSubscriber_test_0500==end==>");
done();
})
/*
* @tc.number: ActsSubscriber_test_xts_0500
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsSubscriber_test_xts_0500', 0, async function (done) {
console.debug("==ActsSubscriber_test_0500==begin==>");
await notify.subscribe(subInfob, {bundleNames:["com.example.actsanspublishtest"]},subscribeCallbackl);
await notify.unsubscribe(subInfob, unSubscribeCallbacki);
console.debug("==ActsSubscriber_test_0500==end3==>");
done();
})
/*
* @tc.number: ActsSubscriber_test_xts_0600
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsSubscriber_test_xts_0600', 0, async function (done) {
console.debug("==ActsSubscriber_test_0600==begin==>");
await notify.subscribe(subInfoc, {bundleNames:["com.example.actsanspublishtest"]}).then(async()=> {
console.log("ActsSubscriber_test_0600=======promise")
await notify.unsubscribe(subInfoc, unSubscribeCallbackj)
});
console.debug("==ActsSubscriber_test_0600==end==>");
done();
})
/*
* @tc.number: ActsSubscriber_test_xts_0700
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsSubscriber_test_xts_0700', 0, async function (done) {
console.debug("==ActsSubscriber_test_0700==begin==>");
await notify.subscribe(subInfod, {bundleNames:["com.example.actsanspublishtest","com.example.actsanspublishtest"]},subscribeCallbackn);
console.debug("==ActsSubscriber_test_0700==end==>");
await notify.unsubscribe(subInfod, unSubscribeCallbackl);
done();
})
/*
* @tc.number: ActsSubscriber_test_xts_0800
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsSubscriber_test_xts_0800', 0, async function (done) {
console.debug("==ActsSubscriber_test_0900==begin==>");
await notify.subscribe(subInfoe, {bundleNames:["com.example.actsanspublishtest","com.example.actsanspublishtest"]}).then(async()=> {
console.log("ActsSubscriber_test_0900=======promise")
await notify.unsubscribe(subInfoe, unSubscribeCallbackm)
});
console.debug("==ActsSubscriber_test_0900==end==>");
done();
})
/*
* @tc.number: ActsSubscriber_test_xts_0900
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsSubscriber_test_xts_0900', 0, async function (done) {
console.debug("==ActsSubscriber_test_1000==begin==>");
var promise = notify.subscribe(100,{bundleNames:["com.example.actsanspublishtest"]});
expect(promise).assertEqual(undefined);
console.debug("==ActsSubscriber_test_1000==end==>");
done();
})
/*
* @tc.number: ActsSubscriber_test_xts_1000
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsSubscriber_test_xts_1000', 0, async function (done) {
console.debug("==ActsSubscriber_test_1000==begin==>");
var subInfo = null
var promise = await notify.subscribe(subInfo,{bundleNames:["com.example.actsanspublishtest"]});
expect(promise).assertEqual(undefined);
console.debug("==ActsSubscriber_test_1000==end==>");
done();
})
/*
* @tc.number: ActsSubscriber_test_xts_1100
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsSubscriber_test_xts_1100', 0, async function (done) {
console.debug("==ActsSubscriber_test_1200==begin==>");
var subInfo = "#$#%$%$^&%^%"
var promise = notify.subscribe(subInfo,{bundleNames:["com.example.actsanspublishtest"]});
expect(promise).assertEqual(undefined);
console.debug("==ActsSubscriber_test_1200==end==>");
done();
})
/*
* @tc.number: ActsSubscriber_test_xts_1200
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsSubscriber_test_xts_1200', 0, async function (done) {
console.debug("==ActsSubscriber_test_1200==begin==>");
var subInfo = ""
var promise = await notify.subscribe(subInfo,{bundleNames:["com.example.actsanspublishtest"]});
expect(promise).assertEqual(undefined);
console.debug("==ActsSubscriber_test_1200==end==>");
done();
})
/*
* @tc.number: ActsSubscriber_test_xts_1300
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsSubscriber_test_xts_1300', 0, async function (done) {
console.debug("==ActsSubscriber_test_1300==begin==>");
var subInfo ={
onConnect:connectCallbackl,
onDisconnect:disconnectCallbackn,
}
await notify.subscribe(subInfo,{bundleNames:["wrongBudleName"]},subscribeCallbacko);
await notify.unsubscribe(subInfo, unSubscribeCallbackn);
console.debug("==ActsSubscriber_test_1300==end==>");
done();
})
/*
* @tc.number: ActsSubscriber_test_xts_1400
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsSubscriber_test_xts_1400', 0, async function (done) {
console.debug("==ActsSubscriber_test_1400==begin==>");
var subInfo ={
onConnect:connectCallbacko,
onDisconnect:disconnectCallbacko,
}
try{
await notify.subscribe(subInfo, {bundleNames: []}, subscribeCallbackp);
}catch(err){
console.debug("==ActsSubscriber_test_1400==err==>"+err);
}
console.debug("==ActsSubscriber_test_1400==end==>");
done();
})
})
......@@ -17,6 +17,7 @@ group("SubscribeAndPublish") {
testonly = true
if (is_standard_system) {
deps = [
"actspublish:ActsPublish",
"actssubscriberorderedtest:ActsSubscriberOrderTest",
"actssubscriberunordersystemtest:ActsSubscriberTestUnorderSystemTest",
"actssubscriberunordertest:ActsSubscriberUnorderTest",
......
# 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsPublish") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsPublish"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "180000",
"package": "com.example.actspublish",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"actsPublish.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actspublish",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actspublish",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"defPermissions": [
{
"availableScope": [],
"grantMode": "system_grant",
"name": "publish_event0800_permission"
},
{
"availableScope": [],
"grantMode": "system_grant",
"name": "publish_event0900_subscriberPermissions"
},
{
"availableScope": [],
"grantMode": "system_grant",
"name": "publish_event0900_publisherPermission"
},
{
"availableScope": [],
"grantMode": "system_grant",
"name": "publish_event1000_permission"
},
{
"availableScope": [],
"grantMode": "system_grant",
"name": "permission.COMMONEVENT_STICKY"
}
],
"reqPermissions": [
{
"name": "publish_event0800_permission",
"reason": "ceshi"
},
{
"name": "publish_event0900_subscriberPermissions",
"reason": "ceshi"
},
{
"name": "publish_event0900_publisherPermission",
"reason": "ceshi"
},
{
"name": "publish_event1000_permission",
"reason": "ceshi"
},
{
"name": "permission.COMMONEVENT_STICKY",
"reason": "ceshi"
}
],
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"visible": true,
"name": "com.example.actspublish.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
/*
* 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.
*/
export default {
onCreate() {
console.info("============== AceApplication onCreate ==============");
},
onDestroy() {
console.info('=============AceApplication onDestroy=============');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
<div class="container">
<text class="title">
您好,地球1111
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* 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 file from '@system.file'
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
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'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
},
}
{
"string": [
{
"name": "app_name",
"value": "JsHelloWorld"
},
{
"name": "mainability_description",
"value": "hap sample empty page"
}
]
}
\ No newline at end of file
/*
* 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 CommonEvent from '@ohos.commonevent'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('Actspublish_0100', function () {
console.info("===========ActspublishAsUser start====================>");
it('Actspublishr_0100', 0, async function (done) {
function PublishCallBack(err) {
if (err.code) {
console.error("publish failed " + JSON.stringify(err));
} else {
console.info("publish success");
expect(event).assertEqual("event_test");
}
}
var event = "event_test"
CommonEvent.publishAsUser(event, 100, PublishCallBack);
done();
})
})
/*
* 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.
*/
require('./ActsPublish.js')
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册