提交 d5beb43e 编写于 作者: O openharmony_ci 提交者: Gitee

!891 L2 失败用例修改

Merge pull request !891 from jiyong/OpenHarmony-3.0-LTS
......@@ -15,7 +15,7 @@
import commonEvent from "@ohos.commonevent"
import rpc from "@ohos.rpc"
import featureAbility from '@ohos.ability.featureAbility'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
const TIMEOUT = 9000;
const START_ABILITY_TIMEOUT = 5000;
......@@ -27,7 +27,7 @@ var subscriberInfoStartAbility_0200 = {
events: ["ACTS_Particle_StartAbility_0200_CommonEvent"],
};
describe('ActsStServiceAbilityTest', function () {
describe('ActsParticleAbilityTest', function () {
let bundleName = "com.example.particletestserver";
let abilityName = "com.example.particletestserver.MainAbility";
var mRemote;
......@@ -55,10 +55,10 @@ describe('ActsStServiceAbilityTest', function () {
}
/*
* @tc.number: ACTS_ParticleAbility_startAbility_0100
* @tc.name: ConnectAbility : Connects an ability to a Service ability.
* @tc.desc: Check the return value of the interface (by Promise)
*/
* @tc.number: ACTS_ParticleAbility_startAbility_0100
* @tc.name: ConnectAbility : Connects an ability to a Service ability and use service to test startAbiltiy.
* @tc.desc: Check the event of the interface startAbiltiy (by promise)
*/
it('ACTS_ParticleAbility_startAbility_0100', 0, async function (done) {
console.log('ACTS_ParticleAbility_startAbility_0100====<begin');
console.log('========StartConnect called');
......@@ -118,68 +118,68 @@ describe('ActsStServiceAbilityTest', function () {
}, TIMEOUT);
})
/*
/*
* @tc.number: ACTS_ParticleAbility_startAbility_0200
* @tc.name: ConnectAbility : Connects an ability to a Service ability.
* @tc.desc: Check the return value of the interface (by Promise)
* @tc.name: ConnectAbility : Connects an ability to a Service ability and use service to test startAbiltiy.
* @tc.desc: Check the event of the interface startAbiltiy (by callback)
*/
it('ACTS_ParticleAbility_startAbility_0200', 0, async function (done) {
console.log('ACTS_ParticleAbility_startAbility_0200====<begin');
console.log('========StartConnect called');
var subscriber;
let id;
let connId;
function subscribeCallBack(err, data) {
clearTimeout(id);
expect(data.event).assertEqual("ACTS_Particle_StartAbility_0200_CommonEvent");
console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data));
var result = featureAbility.disconnectAbility(
it('ACTS_ParticleAbility_startAbility_0200', 0, async function (done) {
console.log('ACTS_ParticleAbility_startAbility_0200====<begin');
console.log('========StartConnect called');
var subscriber;
let id;
let connId;
function subscribeCallBack(err, data) {
clearTimeout(id);
expect(data.event).assertEqual("ACTS_Particle_StartAbility_0200_CommonEvent");
console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data));
var result = featureAbility.disconnectAbility(
connId,
(error,data) => {
(error, data) => {
console.log('featureAbilityTest DisconnectAbility result errCode : ' + error.code + " data: " + data)
},
);
console.log('DisconnectNative ConnectAbility result : ' + result);
commonEvent.unsubscribe(subscriber, unSubscribeCallback)
done();
}
commonEvent.createSubscriber(subscriberInfoStartAbility_0200).then(async (data) => {
console.debug("====>Create Subscriber====>");
subscriber = data;
await commonEvent.subscribe(subscriber, subscribeCallBack);
})
function unSubscribeCallback() {
console.debug("====>UnSubscribe CallBack====>");
done();
}
function timeout() {
expect().assertFail();
console.debug('ACTS_ParticleAbility_startAbility_0200 timeout');
commonEvent.unsubscribe(subscriber, unSubscribeCallback)
done();
}
id = setTimeout(timeout, START_ABILITY_TIMEOUT);
connId = await featureAbility.connectAbility(
{
bundleName: bundleName,
abilityName: abilityName,
action: "StartAbilityCallback"
},
{
onConnect: onConnectCallback,
onDisconnect: onDisconnectCallback,
onFailed: onFailedCallback,
},
);
console.log('StartConnectNative ConnectAbility connId : ' + connId);
setTimeout(function () {
console.log('StartConnectNative ConnectAbility timeout')
}, TIMEOUT);
commonEvent.unsubscribe(subscriber, unSubscribeCallback)
done();
}
commonEvent.createSubscriber(subscriberInfoStartAbility_0200).then(async (data) => {
console.debug("====>Create Subscriber====>");
subscriber = data;
await commonEvent.subscribe(subscriber, subscribeCallBack);
})
function unSubscribeCallback() {
console.debug("====>UnSubscribe CallBack====>");
done();
}
function timeout() {
expect().assertFail();
console.debug('ACTS_ParticleAbility_startAbility_0200 timeout');
commonEvent.unsubscribe(subscriber, unSubscribeCallback)
done();
}
id = setTimeout(timeout, START_ABILITY_TIMEOUT);
connId = await featureAbility.connectAbility(
{
bundleName: bundleName,
abilityName: abilityName,
action: "StartAbilityCallback"
},
{
onConnect: onConnectCallback,
onDisconnect: onDisconnectCallback,
onFailed: onFailedCallback,
},
);
console.log('StartConnectNative ConnectAbility connId : ' + connId);
setTimeout(function () {
console.log('StartConnectNative ConnectAbility timeout')
}, TIMEOUT);
})
})
\ No newline at end of file
......@@ -63,7 +63,7 @@ describe('ActsAnsGetSlotTestCallback', function () {
expect(err.code).assertEqual(0);
console.debug("====>getSlotActsAnsGetSlotTestCallback_0100 data====>" + JSON.stringify(data));
expect(data.type).assertEqual(notification.SlotType.SOCIAL_COMMUNICATION);
expect(data.level).assertEqual(3);
expect(data.level).assertEqual(4);
expect(data.desc).assertEqual("");
expect(data.badgeFlag).assertEqual(true);
expect(data.bypassDnd).assertEqual(false);
......@@ -127,7 +127,7 @@ describe('ActsAnsGetSlotTestCallback', function () {
expect(err.code).assertEqual(0);
console.debug("====>getSlotActsAnsGetSlotTestCallback_0300 data====>" + JSON.stringify(data));
expect(data.type).assertEqual(notification.SlotType.CONTENT_INFORMATION);
expect(data.level).assertEqual(3);
expect(data.level).assertEqual(2);
expect(data.desc).assertEqual("");
expect(data.badgeFlag).assertEqual(true);
expect(data.bypassDnd).assertEqual(false);
......@@ -161,7 +161,7 @@ describe('ActsAnsGetSlotTestCallback', function () {
expect(err.code).assertEqual(0);
console.debug("====>getSlotActsAnsGetSlotTestCallback_0400 data====>" + JSON.stringify(data));
expect(data.type).assertEqual(notification.SlotType.OTHER_TYPES);
expect(data.level).assertEqual(3);
expect(data.level).assertEqual(1);
expect(data.desc).assertEqual("");
expect(data.badgeFlag).assertEqual(true);
expect(data.bypassDnd).assertEqual(false);
......@@ -195,7 +195,7 @@ describe('ActsAnsGetSlotTestCallback', function () {
expect(err.code).assertEqual(0);
console.debug("====>getSlotActsAnsGetSlotTestCallback_0500 data====>" + JSON.stringify(data));
expect(data.type).assertEqual(notification.SlotType.OTHER_TYPES);
expect(data.level).assertEqual(3);
expect(data.level).assertEqual(1);
expect(data.desc).assertEqual("");
expect(data.badgeFlag).assertEqual(true);
expect(data.bypassDnd).assertEqual(false);
......
......@@ -32,7 +32,7 @@ describe('ActsAnsGetSlotTestPromise', function () {
console.debug("====>getSlotActsAnsGetSlotTestPromise_0100 enter====>");
console.debug("====>getSlotActsAnsGetSlotTestPromise_0100 data====>" + JSON.stringify(data));
expect(data.type).assertEqual(notification.SlotType.SOCIAL_COMMUNICATION);
expect(data.level).assertEqual(3);
expect(data.level).assertEqual(4);
expect(data.desc).assertEqual("");
expect(data.badgeFlag).assertEqual(true);
expect(data.bypassDnd).assertEqual(false);
......@@ -99,7 +99,7 @@ describe('ActsAnsGetSlotTestPromise', function () {
console.debug("====>getSlotPromise CONTENT_INFORMATION ActsAnsGetSlotTestPromise_0300 enter====>");
console.debug("====>getSlotPromise ActsAnsGetSlotTestPromise_0300 data====>" + JSON.stringify(data));
expect(data.type).assertEqual(notification.SlotType.CONTENT_INFORMATION);
expect(data.level).assertEqual(3);
expect(data.level).assertEqual(2);
expect(data.desc).assertEqual("");
expect(data.badgeFlag).assertEqual(true);
expect(data.bypassDnd).assertEqual(false);
......@@ -133,7 +133,7 @@ describe('ActsAnsGetSlotTestPromise', function () {
console.debug("====>getSlotPromise OTHER_TYPES ActsAnsGetSlotTestPromise_0400 enter====>");
console.debug("====>getSlotPromise ActsAnsGetSlotTestPromise_0400 data====>" + JSON.stringify(data));
expect(data.type).assertEqual(notification.SlotType.OTHER_TYPES);
expect(data.level).assertEqual(3);
expect(data.level).assertEqual(1);
expect(data.desc).assertEqual("");
expect(data.badgeFlag).assertEqual(true);
expect(data.bypassDnd).assertEqual(false);
......@@ -167,7 +167,7 @@ describe('ActsAnsGetSlotTestPromise', function () {
console.debug("====>getSlotPromise UNKNOWN_TYPE ActsAnsGetSlotTestPromise_0500 enter====>");
console.debug("====>getSlotPromise ActsAnsGetSlotTestPromise_0500 data====>" + JSON.stringify(data));
expect(data.type).assertEqual(notification.SlotType.OTHER_TYPES);
expect(data.level).assertEqual(3);
expect(data.level).assertEqual(1);
expect(data.desc).assertEqual("");
expect(data.badgeFlag).assertEqual(true);
expect(data.bypassDnd).assertEqual(false);
......
......@@ -32,7 +32,7 @@ describe('ActsAnsRemoveSlotTest', function () {
console.debug("====>getSlotActsAnsGetSlotTestPromise_0100 enter====>");
console.debug("====>getSlotActsAnsGetSlotTestPromise_0100 data====>" + JSON.stringify(data));
expect(data.type).assertEqual(notification.SlotType.SOCIAL_COMMUNICATION);
expect(data.level).assertEqual(3);
expect(data.level).assertEqual(4);
expect(data.desc).assertEqual("");
expect(data.badgeFlag).assertEqual(true);
expect(data.bypassDnd).assertEqual(false);
......
......@@ -20,6 +20,7 @@ group("publish_test") {
#"badgedisplayed:badgedisplayed",
#"badgedisplayedset:badgedisplayedset",
"enablenotification:enablenotification",
#"enablenotificationset:enablenotificationset",
#"getactive:getactive",
"getwantagentinfo:getwantagentinfo",
......@@ -27,6 +28,9 @@ group("publish_test") {
#"publishcontentype:ActsAnsNotificationTest",
#"subscribe:subscribe",
#"unsubscribe:ActsAnsUnSubscriberTest",
#"activeButton:ActsAnsActionButtonTest",
#"publishicontest:ActsAnsIconTest",
#"publishimage:ActsAnsPublishImageTest",
"wantagent:wantagent",
]
}
......
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
/entry/.preview
.cxx
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="1.8" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="PLATFORM" />
<option name="distributionType" value="LOCAL" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="D:\HUAWEI\DevEco Studio 2.1.0.301\tools\gradle" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/entry" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
<option name="useQualifiedModuleNames" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven2" />
<option name="name" value="maven2" />
<option name="url" value="https://developer.huawei.com/repo/" />
</remote-repository>
<remote-repository>
<option name="id" value="BintrayJCenter" />
<option name="name" value="BintrayJCenter" />
<option name="url" value="https://jcenter.bintray.com/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven" />
<option name="name" value="maven" />
<option name="url" value="https://repo.huaweicloud.com/repository/maven/" />
</remote-repository>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
</project>
\ 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("ActsAnsActionButtonTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAnsActionButtonTest"
}
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.actsansactionbuttontest",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAnsActionButtonTest"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsansactionbuttontest",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsansactionbuttontest",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.actsansactionbuttontest.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">
activeButton
</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": "ActiveBtn"
},
{
"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.
*/
import notify from '@ohos.notification'
import wantagent from '@ohos.wantAgent'
import image from '@ohos.multimedia.image'
import { OperationType, Flags } from '@ohos.wantagent'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
var largeBuffer
var smallBuffer
var opts
var subInfo
var largeIcon
var smallIcon
var time = 1000
describe('ActsAnsActionButtonTest', function () {
console.info("===========ActsDoNotSubscriberTest start====================>");
//consume
function consumeCallback(err,data) {
console.debug("==========================>consumeDoNotCallbackOne data : =======================>" +err+ JSON.stringify(data));
expect(typeof(data.request.actionButtons)).assertEqual('object')
for(let i=0; i<data.request.actionButtons; i++)
{
console.debug("======consumeCallback====data.actionButtons.title:====>" + data.request.actionButtons[i].title);
console.debug("======consumeCallback====sortings.hashCode:====>" + data.request.actionButtons[i].wantAgent);
console.debug("======consumeCallback====sortings.hashCode:====>" + data.request.actionButtons[i].icon);
}
}
//consume
function consumeCallbackTwo(err,data) {
console.debug("==========================>consumeDoNotCallbackTwo data : =======================>" +err+ JSON.stringify(data));
expect(typeof(data.request.actionButtons)).assertEqual('object')
for(let i=0; i<data.request.actionButtons; i++)
{
console.debug("======consumeDoNotCallbackTwo====sortings.hashCode:====>" + data.request.actionButtons[i].title);
console.debug("======consumeDoNotCallbackTwo====sortings.hashCode:====>" + data.request.actionButtons[i].wantAgent);
console.debug("======consumeCallback====sortings.hashCode:====>" + data.request.actionButtons[i].icon);
}
}
//subscribe
function subscribeCallback(err) {
console.debug("==========================>subscribeDoNotCallback=======================>");
}
function publishCallback200(){
console.debug("==========================>publishCallback200=======================>");
}
/*
* @tc.number: ActsDoNotSubscriber_test_0100
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsActiveButton_test_0100', 0, async function (done) {
console.debug("===============ActsActiveButton_test_0100======begin====================>");
var subInfo ={
onConsume:consumeCallback
}
try{
await notify.subscribe(subInfo,subscribeCallback);
}catch(err) {
console.error('=ActsActiveButton_test_0100 订阅 activeButton err:'+err);
}
console.debug("===============ActsActiveButton_test_0100=======end3===================>");
var agentInfo = {
wants: [
{
deviceId: "deviceId",
bundleName: "com.example.test",
abilityName: "com.example.test.TriggerAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
parameters:
{
mykey0: 2222,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "ssssssssssssssssssssssssss",
mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"],
mykey6: true,
}
}
],
operationType: OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags:[Flags.UPDATE_PRESENT_FLAG]
};
var wantAgentData = await wantagent.getWantAgent(agentInfo);
largeBuffer = new ArrayBuffer(64);
smallBuffer = new ArrayBuffer(32);
opts = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 2, width: 3}}
const promise_Large = image.createPixelMap(largeBuffer, opts);
promise_Large.then((data) => {
console.debug("==========================createPixelMap_promise_Large=======================>");
largeIcon = data;
console.debug("==========================createPixelMap_promise_Large largeIcon=======================>"+largeIcon);
const promise_Small = image.createPixelMap(smallBuffer, opts);
promise_Small.then((data) => {
console.debug("==========================createPixelMap_promise_Small=======================>");
smallIcon = data;
console.debug("==========================createPixelMap_promise_Small smallIcon=======================>"+smallIcon);
var notificationRequest = {
content:{
contentType: notify.ContentType.NOTIFICATION_CONTENT_LONG_TEXT,
longText : {
title: "test_title",
text: "test_text",
additionalText: "test_additionalText",
longText: "long_text",
briefText: "long_briefText",
expandedTitle: "long_expandedTitle"
},
},
id: 1,
slotType : notify.SlotType.SERVICE_INFORMATION,
actionButtons: [{title:"button", wantAgent:wantAgentData,icon:largeIcon},{title:"button", wantAgent:wantAgentData,icon:smallIcon}]
}
notify.publish(notificationRequest, publishCallback200);
console.info("===============ActsActiveButton_test_0100==========================>");
done();
setTimeout(function(){
console.debug("====>time out ActsActiveButton_test_0100====>");
}, time);
})
})
})
})
/*
* 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('./ActiveButton.js')
<div class="container">
<text class="title">
通知许可设定--参数传空0928
通知许可设定--参数传空1111
</text>
</div>
......@@ -42,10 +42,11 @@ describe('ActsAnsEnableNotificationFiveTest', function () {
* @tc.desc: verify the function of enableNotification
*/
it('ActsEnableNotification_test_1000', 0, async function (done) {
await notify.enableNotification(
var promise = notify.enableNotification(
{
bundle:"com.example.actsanslocalnotificationtest",
},"").then(console.log("====>ActsEnableNotification_test_1000 success====>"))
},"")
expect(promise).assertEqual(undefined)
done();
setTimeout(function(){
console.debug("====>time out ActsEnableNotification_test_1000====>");
......
......@@ -42,10 +42,11 @@ describe('ActsAnsEnableNotificationFourTest', function () {
* @tc.desc: verify the function of enableNotification
*/
it('ActsEnableNotification_test_0800', 0, async function (done) {
await notify.enableNotification(
var promise = notify.enableNotification(
{
bundle:"com.example.actsanslocalnotificationtest",
},100).then(console.log("====>ActsEnableNotification_test_0800 success====>"))
},100)
expect(promise).assertEqual(undefined)
done();
setTimeout(function(){
console.debug("====>time out ActsEnableNotification_test_0800====>");
......
......@@ -42,10 +42,11 @@ describe('ActsAnsEnableNotificationSetFiveTest', function () {
* @tc.desc: verify the function of enableNotification
*/
it('ActsEnableNotificationSet_test_1000', 0, async function (done) {
await notify.enableNotification(
var promise = notify.enableNotification(
{
bundle:"com.example.actsanslocalnotificationtest",
},"").then(console.log("====>ActsEnableNotificationSet_test_1000 success====>"))
},"")
expect(promise).assertEqual(undefined)
done();
setTimeout(function(){
console.debug("====>time out ActsEnableNotificationSet_test_1000====>");
......
......@@ -42,10 +42,11 @@ describe('ActsAnsEnableNotificationSetFourTest', function () {
* @tc.desc: verify the function of enableNotification
*/
it('ActsEnableNotificationSet_test_0800', 0, async function (done) {
await notify.enableNotification(
var promise = notify.enableNotification(
{
bundle:"com.example.actsanslocalnotificationtest",
},100).then(console.log("====>ActsEnableNotificationSet_test_0800 success====>"))
},100)
expect(promise).assertEqual(undefined)
done();
setTimeout(function(){
console.debug("====>time out ActsEnableNotificationSet_test_0800====>");
......
{
"app": {
"bundleName": "com.neu.actsansactivesubscribertest",
"bundleName": "com.example.actsansactivesubscribertest",
"vendor": "example",
"version": {
"code": 1,
......@@ -59,4 +59,4 @@
}
]
}
}
\ No newline at end of file
}
......@@ -147,17 +147,17 @@ describe('ActsAnsGetWantAgentInfoOneProTest', function () {
console.info(data);
expect(typeof(data)).assertEqual("object");
wantAgent.equal(WantAgent1,WantAgent2).then(
(error,data) => {
(data) => {
console.info('----equalPromise1 success!----')
console.info(data);
expect(typeof(data)).assertEqual("boolean");
expect(data).assertEqual(false);
}
)
wantAgent.equal(WantAgent1,WantAgent1).then(
(error,data) => {
(data) => {
console.info('----equalPromise2 success!----')
console.info(data);
expect(typeof(data)).assertEqual("boolean");
expect(data).assertEqual(true);
}
)
}
......
......@@ -71,10 +71,10 @@ describe('ActsAnsGetWantAgentInfoTwoProTest', function () {
expect(typeof(data)).assertEqual("object");
}
done();
}),
setTimeout(function(){
console.debug("====>time out ACTS_SetWantInfo_0700====>");
}, time)
}),
console.info('----getWantAgent1 after----');
})
......@@ -121,17 +121,17 @@ describe('ActsAnsGetWantAgentInfoTwoProTest', function () {
console.info(data);
expect(typeof(data)).assertEqual("object");
wantAgent.equal(WantAgent1,WantAgent2).then(
(error,data) => {
(data) => {
console.info('----equalPromise1 success!----')
console.info(data);
expect(typeof(data)).assertEqual("boolean");
expect(data).assertEqual(false);
}
)
wantAgent.equal(WantAgent1,WantAgent1).then(
(error,data) => {
(data) => {
console.info('----equalPromise2 success!----')
console.info(data);
expect(typeof(data)).assertEqual("boolean");
expect(data).assertEqual(true);
}
)
}
......@@ -141,10 +141,11 @@ describe('ActsAnsGetWantAgentInfoTwoProTest', function () {
expect(typeof(data)).assertEqual("object");
}
done();
});
setTimeout(function(){
console.debug("====>time out ACTS_SetWantInfo_0800====>");
}, time)
});
console.info('----getWantAgent2 after----');
})
})
......
{
"app": {
"bundleName": "com.neu.actsansnotificationtest",
"bundleName": "com.example.actsansnotificationtest",
"vendor": "example",
"version": {
"code": 1,
......@@ -59,4 +59,4 @@
}
]
}
}
\ 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("ActsAnsIconTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAnsIconTest"
}
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": "120000",
"package": "com.example.actsansicontest",
"shell-timeout": "120000"
},
"kits": [
{
"test-file-name": [
"ActsAnsIconTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsansicontest",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsansicontest",
"name": ".actsansicontest",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.actsansicontest.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
/*
* 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_pixcelMap
</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.
*/
import notify from '@ohos.notification'
import image from '@ohos.multimedia.image'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
var largeBuffer
var smallBuffer
var opts
var subInfo
var largeIcon
var smallIcon
var time = 1000
describe('ActsAnsIconTest', function () {
console.info("===========ActsAnsIconTest start====================>");
//consume
function consumeCallback(err,data) {
console.debug("==========================consumeCallback data : =======================>" +err+ JSON.stringify(data));
console.log("==========================consumeCallback smallIcon : =======================>"+JSON.stringify(data.request.smallIcon))
console.log("==========================consumeCallback largeIcon : =======================>"+JSON.stringify(data.request.largeIcon))
}
function subscribeCallback(err) {
console.info("==========================subscribeCallback start=======================>");
console.info("================subscribeCallback err : =======================>" + JSON.stringify(err));
console.info("==========================subscribeCallback end=======================>");
}
function publishCallback(err){
console.info("==========================publishCallback start=======================>");
console.info("================publishCallback err : =======================>" + JSON.stringify(err));
console.info("==========================publishCallback end=======================>");
}
/*
* @tc.number: ActsAnsIconTest_0100
* @tc.name: createPixelMap()
* @tc.desc: verify the function of subscribe
*/
it('ActsAnsIconTest_0100', 0, async function (done) {
console.debug("===============ActsAnsIconTest_0100 start====================>");
subInfo ={
onConsume:consumeCallback,
}
await notify.subscribe(subInfo,subscribeCallback);
largeBuffer = new ArrayBuffer(64);
smallBuffer = new ArrayBuffer(32);
opts = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 2, width: 3}}
const promise_Large = image.createPixelMap(largeBuffer, opts);
promise_Large.then((data) => {
console.debug("==========================createPixelMap_promise_Large=======================>");
largeIcon = data;
console.debug("==========================createPixelMap_promise_Large largeIcon=======================>"+largeIcon);
const promise_Small = image.createPixelMap(smallBuffer, opts);
promise_Small.then((data) => {
console.debug("==========================createPixelMap_promise_Small=======================>");
smallIcon = data;
console.debug("==========================createPixelMap_promise_Small smallIcon=======================>"+smallIcon);
notify.publish({
id: 1,
content: {
contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal: {
title: "test1_title",
text: "test1_text",
additionalText: "test1_additionalText"
},
},
slotType:notify.SlotType.SOCIAL_COMMUNICATION,
classification:"classification1",
sortingKey:"sortingKey1",
smallIcon:smallIcon,
largeIcon:largeIcon,
},publishCallback);
done();
setTimeout(function(){
console.debug("====>time out ActsAnsIconTest_0100====>");
}, time);
});
})
})
});
/*
* 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('./Icon.js')
\ No newline at end of file
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
/entry/.preview
.cxx
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="1.8" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="PLATFORM" />
<option name="distributionType" value="LOCAL" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="D:\HUAWEI\DevEco Studio 2.1.0.301\tools\gradle" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/entry" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
<option name="useQualifiedModuleNames" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven2" />
<option name="name" value="maven2" />
<option name="url" value="https://developer.huawei.com/repo/" />
</remote-repository>
<remote-repository>
<option name="id" value="BintrayJCenter" />
<option name="name" value="BintrayJCenter" />
<option name="url" value="https://jcenter.bintray.com/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven" />
<option name="name" value="maven" />
<option name="url" value="https://repo.huaweicloud.com/repository/maven/" />
</remote-repository>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
</project>
\ 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("ActsAnsPublishImageTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAnsPublishImageTest"
}
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.actsanspublishimagetest",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAnsPublishImageTest"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsanspublishimagetest",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsanspublishimagetest",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.actsanspublishimagetest.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": "Pubimage"
},
{
"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('./publishImage.js')
/*
* 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 image from '@ohos.multimedia.image'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
var imageBuffer
var opts
var pubimage
var time = 1000
describe('ActsAnsPublishImageTest', function () {
console.info("===========ActsDoNotSubscriberTest start====================>");
//consume
function consumeCallbackOne(err,data) {
console.debug("==========================>consumeDoNotCallback1 data : =======================>" +err+ JSON.stringify(data));
checkConsumeData(data)
}
function consumeCallbackTwo(err,data) {
console.debug("==========================>consumeDoNotCallback2 data : =======================>" +err+ JSON.stringify(data));
checkConsumeData(data)
}
function checkConsumeData(data){
expect(typeof(data)).assertEqual("object");
expect(data.id).assertEqual(1);
expect(data.content.contentType).assertEqual(notify.ContentType.NOTIFICATION_CONTENT_PICTURE);
expect(data.content.picture.title).assertEqual("image_title");
expect(data.content.picture.text).assertEqual("image_text");
expect(data.content.picture.additionalText).assertEqual("image_additionalText");
expect(data.content.picture.briefText).assertEqual("image_briefText");
expect(data.content.picture.expandedTitle).assertEqual("expandedTitle");
// expect(typeof(data.content.picture.picture)).assertEqual();
expect(data.slotType).assertEqual(notify.SlotType.SOCIAL_COMMUNICATION);
expect(data.classification).assertEqual("classification1");
expect(data.sortingKey).assertEqual("sortingKey1");
}
//subscribeOn
function subscribeOnCallback(err) {
console.debug("==========================>subscribeDoNotOnCallback=======================>");
}
//subscribe
function subscribeCallback(err) {
console.debug("==========================>subscribeDoNotCallback=======================>");
}
function publishCallback001(){
console.log('ActsAnsPublishImageTest ACTS_Publish_0100 asyncCallback')
}
/*
* @tc.number: ActsPublishImage_test_0100
* @tc.name: subscribe()
* @tc.desc: verify the function of subscribe
*/
it('ActsPublishImage_test_0100', 0, async function (done) {
console.debug("===============ActsDoNotSubscriber_test_0100======begin====================>");
var subInfo ={
onConsume:consumeCallbackOne,
onConnecte:subscribeOnCallback,
}
try {
await notify.subscribe(subInfo, subscribeCallback);
}
catch(err) {
console.error('=ActsDoNotSubscriber_test_0100 订阅 subscribeDoNotCallback err:'+err);
}
console.debug("===============ActsSubscriber_test_0100=======end3===================>");
done();
setTimeout(function(){
console.debug("====>time out ActsPublishImage_test_0100====>");
}, time);
})
/*
* @tc.number: ACTS_publishTest_0100
* @tc.name: publish()
* @tc.desc: verify the function of publish
*/
it('ActsPublishImage_test_0200', 0,async function (done) {
imageBuffer = new ArrayBuffer(32);
opts = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 2, width: 3}}
const promise_Large = image.createPixelMap(imageBuffer, opts);
promise_Large.then((data) => {
console.debug("==========================createPixelMap_promise_Large=======================>");
pubimage = data;
console.debug("==========================createPixelMap_promise_Large largeIcon=======================>"+pubimage);
notify.publish({
id: 1,
content: {
contentType: notify.ContentType.NOTIFICATION_CONTENT_PICTURE,
picture: {
title: "image_title",
text: "image_text",
additionalText: "image_additionalText",
briefText:"image_brief",
expandedTitle:"expandedTitle",
picture:pubimage
},
},
slotType:notify.SlotType.SOCIAL_COMMUNICATION,
classification:"classification1",
sortingKey:"sortingKey1",
},publishCallback001);
done()
setTimeout(function(){
console.debug("====>time out ACTS_publishTest_0100====>");
}, time);
})
})
})
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册