提交 2ff715d0 编写于 作者: O openharmony_ci 提交者: Gitee

!911 fms xts

Merge pull request !911 from blackleon/master_fms_1018
......@@ -20,6 +20,7 @@ group("aafwk_standard") {
#"abilitymanager:actsabilitymanagertest",
"context:context",
"featureability:featureability",
"formmanager:formmanager",
"want:want",
]
}
......
# 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")
group("formmanager") {
testonly = true
if (is_standard_system) {
deps = [
"formsystemtesthost/getallformsinfo:GetAllFormsInfo",
"formsystemtestservice/formsystemtestservicea:ActsFormSystemTestServiceA",
"formsystemtestservice/formsystemtestserviceb:ActsFormSystemTestServiceB",
]
}
}
# 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("GetAllFormsInfo") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "GetAllFormsInfo"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "240000",
"package": "com.example.getallformsinfo",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"GetAllFormsInfo.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "ShellKit",
"run-command": [
"remount",
"mkdir /system/vendor"
]
},
{
"type": "PushKit",
"push": [
"GetAllFormsInfo.hap->/data/GetAllFormsInfo.hap"
]
},
{
"type": "ShellKit",
"run-command": [
"chmod 644 /system/vendor/*.hap"
]
}
]
}
{
"app": {
"bundleName": "com.example.getallformsinfo",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.getallformsinfo",
"name": ".MyApplication",
"mainAbility": "com.example.getallformsinfo.MainAbility",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": false
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"visible": true,
"name": "com.example.getallformsinfo.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard"
}
],
"defPermissions": [
{
"name": "com.permission.CAMERA",
"grantMode": "system_grant",
"availableScope": ["signature"],
"label": "$string:testFormA",
"description": "CAMERA permission in detail"
},
{
"name": "ohos.permission.REQUIRE_FORM",
"grantMode": "system_grant",
"label": "$string:testForm",
"description": "REQUIRE_FORM permission in detail"
}
],
"reqPermissions": [
{
"name": "ohos.permission.REQUIRE_FORM",
"reason": "require form",
"usedScene": {
"ability": [
".MainAbility"
],
"when": "always"
}
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": true
}
}
]
}
}
\ 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: 40px;
color: #000000;
opacity: 0.9;
}
@media screen and (device-type: tablet) and (orientation: landscape) {
.title {
font-size: 100px;
}
}
@media screen and (device-type: wearable) {
.title {
font-size: 28px;
color: #FFFFFF;
}
}
@media screen and (device-type: tv) {
.container {
background-image: url("/common/images/Wallpaper.png");
background-size: cover;
background-repeat: no-repeat;
background-position: center;
}
.title {
font-size: 100px;
color: #FFFFFF;
}
}
@media screen and (device-type: phone) and (orientation: landscape) {
.title {
font-size: 60px;
}
}
<div class="container">
<text class="title">
{{ $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 app from '@system.app'
import file from '@system.file'
import router from '@system.router'
import device from '@system.device'
import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: ""
},
onInit() {
this.title = "卡片配置信息查询 \n有权限、是系统应用";
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
const reportExtend = new ReportExtend(file)
core.addService('expect', expectExtend)
core.addService('report', reportExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
console.info('onShow end')
},
onReady() {
},
}
/*
* 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 formManager from '@ohos.ability.formManager'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
const TIMEOUT = 1000;
describe('getAllFormsInfoTest', function () {
console.log("system application and has permissions Test");
/**
* @tc.name getAllFormsInfo test
* @tc.number FMS_getFormsInfo_0300
* @tc.desc All form configuration information is queried successfully (by AsyncCallback)
*/
it('FMS_getFormsInfo_0300_callback', 0, async function (done) {
console.log("FMS_getFormsInfo_0300_callback begin");
var ret = formManager.getAllFormsInfo(
(result, data) => {
console.log("FMS_getFormsInfo_0300_callback async::sucess, data json:"
+ JSON.stringify(data));
console.log("FMS_getFormsInfo_0300_callback async::result, result:" + result);
expect(result).assertEqual(1);
for(var i = 0; i < data.length; i++) {
expect(typeof (data[i].description)).assertEqual("string");
expect(data[i].description).assertEqual("form_description");
expect(data[i].type).assertEqual(1);
expect(data[i].jsComponentName).assertEqual("card");
expect(data[i].colorMode).assertEqual(-1);
expect(data[i].isDefault).assertEqual(1);
expect(data[i].updateEnabled).assertEqual(1);
expect(data[i].scheduledUpdateTime).assertEqual("0:0");
expect(data[i].formVisibleNotify).assertEqual(0);
expect(data[i].defaultDimension).assertEqual(1);
expect(data[i].supportDimensions[0]).assertEqual(1);
expect(data[i].supportDimensions[1]).assertEqual(2);
expect(data[i].metaData.customizeData[0].name).assertEqual("originWidgetName");
expect(data[i].metaData.customizeData[0].value).assertEqual("myTest");
}
expect(data[0].name).assertEqual("Form_Js001");
expect(data[1].name).assertEqual("Form_Js002");
expect(data[0].updateDuration).assertEqual(0);
expect(data[1].updateDuration).assertEqual(1);
console.log("FMS_getFormsInfo_0300_callback result end");
done();
}
);
setTimeout(function () {
console.info('=====================FMS_getFormsInfo_0300_callback==================end');
}, TIMEOUT)
console.log("FMS_getFormsInfo_0300_callback end, ret:"+ret);
})
/**
* @tc.name getAllFormsInfo test
* @tc.number FMS_getFormsInfo_0300
* @tc.desc All form configuration information is queried successfully (by Promise)
*/
it('FMS_getFormsInfo_0300_promise', 0, async function (done) {
console.log("FMS_getFormsInfo_0300_promise begin");
var promise = formManager.getAllFormsInfo();
promise.then((data) => {
console.log("FMS_getFormsInfo_0300_promise async::sucess, data json:" + JSON.stringify(data));
for(var i = 0; i < data.length; i++) {
expect(typeof (data[i].description)).assertEqual("string");
expect(data[i].description).assertEqual("form_description");
expect(data[i].type).assertEqual(1);
expect(data[i].jsComponentName).assertEqual("card");
expect(data[i].colorMode).assertEqual(-1);
expect(data[i].isDefault).assertEqual(1);
expect(data[i].updateEnabled).assertEqual(1);
expect(data[i].scheduledUpdateTime).assertEqual("0:0");
expect(data[i].formVisibleNotify).assertEqual(0);
expect(data[i].defaultDimension).assertEqual(1);
expect(data[i].supportDimensions[0]).assertEqual(1);
expect(data[i].supportDimensions[1]).assertEqual(2);
expect(data[i].metaData.customizeData[0].name).assertEqual("originWidgetName");
expect(data[i].metaData.customizeData[0].value).assertEqual("myTest");
}
expect(data[0].name).assertEqual("Form_Js001");
expect(data[1].name).assertEqual("Form_Js002");
expect(data[0].updateDuration).assertEqual(0);
expect(data[1].updateDuration).assertEqual(1);
console.log("FMS_getFormsInfo_0300_promise result end");
done();
}
);
setTimeout(function () {
console.info('=====================FMS_getFormsInfo_0300_promise==================end');
}, TIMEOUT)
})
/**
* @tc.name bundleName is null test
* @tc.number FMS_getFormsInfo_0600
* @tc.desc When the bundleName is null, the form configuration information query fails
* (by AsyncCallback)
*/
it('FMS_getFormsInfo_0600_callback', 0, async function (done) {
console.log("FMS_getFormsInfo_0600_callback begin");
var ret = formManager.getFormsInfo(
"",
(result, data) => {
console.log("FMS_getFormsInfo_0600_callback getFormsInfo async::sucess, data json:"
+ JSON.stringify(data));
console.log("FMS_getFormsInfo_0600_callback async::result, result:" + result);
expect(result).assertEqual(0);
console.log("FMS_getFormsInfo_0600_callback result end");
done();
}
);
setTimeout(function () {
console.info('=====================FMS_getFormsInfo_0600_callback==================end');
}, TIMEOUT)
console.log("FMS_getFormsInfo_0600_callback end, ret:"+ret);
})
/**
* @tc.name bundleName is null test
* @tc.number FMS_getFormsInfo_0600
* @tc.desc When the bundleName is null, the form configuration information query fails (by Promise)
*/
it('FMS_getFormsInfo_0600_promise', 0, async function (done) {
console.log("FMS_getFormsInfo_0600_promise begin");
var promise = formManager.getFormsInfo(
"",
);
promise.then((result) => {
console.log("FMS_getFormsInfo_0600_promise result:" + result);
expect(result).assertEqual(0);
console.log("FMS_getFormsInfo_0600_promise result end");
done();
}
);
setTimeout(function () {
console.info('=====================FMS_getFormsInfo_0600_promise==================end');
}, TIMEOUT)
})
/**
* @tc.name bundleName isn't exist test
* @tc.number FMS_getFormsInfo_0700
* @tc.desc When the bundleName isn't exist, the form configuration information query fails
* (by AsyncCallback).
*/
it('FMS_getFormsInfo_0700_callback', 0, async function (done) {
console.log("FMS_getFormsInfo_0700_callback begin");
var ret = formManager.getFormsInfo(
"aaaaaaa",
(result, data) => {
console.log("FMS_getFormsInfo_0700_callback getFormsInfo async::sucess, data json:"
+ JSON.stringify(data));
console.log("FMS_getFormsInfo_0700_callback async::result, result:" + result);
expect(result).assertEqual(0);
console.log("FMS_getFormsInfo_0700_callback result end");
done();
}
);
setTimeout(function () {
console.info('=====================FMS_getFormsInfo_0700_callback==================end');
}, TIMEOUT)
console.log("FMS_getFormsInfo_0700_callback end, ret:"+ret);
})
/**
* @tc.name bundleName isn't exist test
* @tc.number FMS_getFormsInfo_0700
* @tc.desc When the bundleName isn't exist, the form configuration information query fails (by Promise)
*/
it('FMS_getFormsInfo_0700_promise', 0, async function (done) {
console.log("FMS_getFormsInfo_0700_promise begin");
var promise = formManager.getFormsInfo(
"aaaaaaa",
);
promise.then((result) => {
console.log("FMS_getFormsInfo_0700_promise result:" + result);
expect(result).assertEqual(0);
console.log("FMS_getFormsInfo_0700_promise result end");
done();
}
);
setTimeout(function () {
console.info('=====================FMS_getFormsInfo_0700_promise==================end');
}, TIMEOUT)
})
/**
* @tc.name getFormsInfo test
* @tc.number FMS_getFormsInfo_0800
* @tc.desc When the bundleName exist, the form configuration information is queried successfully
* (by AsyncCallback)
*/
it('FMS_getFormsInfo_0800_callback', 0, async function (done) {
console.log("FMS_getFormsInfo_0800_callback begin");
var ret = formManager.getFormsInfo(
"com.form.formsystemtestservicea",
(result, data) => {
console.log("FMS_getFormsInfo_0800_callback getFormsInfo async::sucess, data json:"
+ JSON.stringify(data));
console.log("FMS_getFormsInfo_0800_callback async::result, result:" + result);
for(var i = 0; i < data.length; i++) {
expect(typeof (data[i].description)).assertEqual("string");
expect(data[i].description).assertEqual("form_description");
expect(data[i].type).assertEqual(1);
expect(data[i].jsComponentName).assertEqual("card");
expect(data[i].colorMode).assertEqual(-1);
expect(data[i].isDefault).assertEqual(1);
expect(data[i].updateEnabled).assertEqual(1);
expect(data[i].scheduledUpdateTime).assertEqual("0:0");
expect(data[i].formVisibleNotify).assertEqual(0);
expect(data[i].defaultDimension).assertEqual(1);
expect(data[i].supportDimensions[0]).assertEqual(1);
expect(data[i].supportDimensions[1]).assertEqual(2);
expect(data[i].metaData.customizeData[0].name).assertEqual("originWidgetName");
expect(data[i].metaData.customizeData[0].value).assertEqual("myTest");
}
expect(data[0].name).assertEqual("Form_Js001");
expect(data[1].name).assertEqual("Form_Js002");
expect(data[0].updateDuration).assertEqual(0);
expect(data[1].updateDuration).assertEqual(1);
console.log("FMS_getFormsInfo_0800_callback result end");
done();
}
);
setTimeout(function () {
console.info('=====================FMS_getFormsInfo_0800_callback==================end');
}, TIMEOUT)
console.log("FMS_getFormsInfo_0800_callback end, ret:"+ret);
})
/**
* @tc.name getFormsInfo test
* @tc.number FMS_getFormsInfo_0800
* @tc.desc When the bundleName exist, the form configuration information is queried successfully
* (by Promise)
*/
it('FMS_getFormsInfo_0800_promise', 0, async function (done) {
console.log("FMS_getFormsInfo_0800_promise begin");
var promise = formManager.getFormsInfo(
"com.form.formsystemtestservicea",
);
promise.then((data) => {
console.log("FMS_getFormsInfo_0300_promise async::sucess, data json:" + JSON.stringify(data));
for(var i = 0; i < data.length; i++) {
expect(typeof (data[i].description)).assertEqual("string");
expect(data[i].description).assertEqual("form_description");
expect(data[i].type).assertEqual(1);
expect(data[i].jsComponentName).assertEqual("card");
expect(data[i].colorMode).assertEqual(-1);
expect(data[i].isDefault).assertEqual(1);
expect(data[i].updateEnabled).assertEqual(1);
expect(data[i].scheduledUpdateTime).assertEqual("0:0");
expect(data[i].formVisibleNotify).assertEqual(0);
expect(data[i].defaultDimension).assertEqual(1);
expect(data[i].supportDimensions[0]).assertEqual(1);
expect(data[i].supportDimensions[1]).assertEqual(2);
expect(data[i].metaData.customizeData[0].name).assertEqual("originWidgetName");
expect(data[i].metaData.customizeData[0].value).assertEqual("myTest");
}
expect(data[0].name).assertEqual("Form_Js001");
expect(data[1].name).assertEqual("Form_Js002");
expect(data[0].updateDuration).assertEqual(0);
expect(data[1].updateDuration).assertEqual(1);
console.log("FMS_getFormsInfo_0800_promise result end");
done();
}
);
setTimeout(function () {
console.info('=====================FMS_getFormsInfo_0800_promise==================end');
}, TIMEOUT)
})
/**
* @tc.name getFormsInfo test
* @tc.number FMS_getFormsInfo_1100
* @tc.desc When the bundleName is null, moduleName is exist,the form configuration information
* query fails (by AsyncCallback).
*/
it('FMS_getFormsInfo_1100_callback', 0, async function (done) {
console.log("FMS_getFormsInfo_1100_callback begin");
var ret = formManager.getFormsInfo(
"",
"formmodule001",
(result, data) => {
console.log("FMS_getFormsInfo_1100_callback getFormsInfo async::sucess, data json:"
+ JSON.stringify(data));
console.log("FMS_getFormsInfo_1100_callback async::result, result:" + result);
expect(result).assertEqual(0);
console.log("FMS_getFormsInfo_1100_callback result end");
done();
}
);
setTimeout(function () {
console.info('=====================FMS_getFormsInfo_1100_callback==================end');
}, TIMEOUT)
console.log("FMS_getFormsInfo_1100_callback end, ret:"+ret);
})
/**
* @tc.name getFormsInfo test
* @tc.number FMS_getFormsInfo_1100
* @tc.desc When the bundleName is null, moduleName is exist,the form configuration information
* query fails (by Promise)
*/
it('FMS_getFormsInfo_1100_promise', 0, async function (done) {
console.log("FMS_getFormsInfo_1100_promise begin");
var promise = formManager.getFormsInfo(
"",
"formmodule001",
);
promise.then((result) => {
console.log("FMS_getFormsInfo_1100_promise result:" + result);
expect(result).assertEqual(0);
console.log("FMS_getFormsInfo_1100_promise result end");
done();
}
);
setTimeout(function () {
console.info('=====================FMS_getFormsInfo_1100_promise==================end');
}, TIMEOUT)
})
/**
* @tc.name getFormsInfo test
* @tc.number FMS_getFormsInfo_1200
* @tc.desc When the bundleName isn't exist, moduleName is exist, the form configuration information
* query fails (by AsyncCallback)
*/
it('FMS_getFormsInfo_1200_callback', 0, async function (done) {
console.log("FMS_getFormsInfo_1200_callback begin");
var ret = formManager.getFormsInfo(
"aaaaaa",
"formmodule001",
(result, data) => {
console.log("FMS_getFormsInfo_1200_callback getFormsInfo async::sucess, data json:"
+ JSON.stringify(data));
console.log("FMS_getFormsInfo_1200_callback async::result, result:" + result);
expect(result).assertEqual(0);
console.log("FMS_getFormsInfo_1200_callback result end");
done();
}
);
setTimeout(function () {
console.info('=====================FMS_getFormsInfo_1200_callback==================end');
}, TIMEOUT)
console.log("FMS_getFormsInfo_1200_callback end, ret:"+ret);
})
/**
* @tc.name getFormsInfo test
* @tc.number FMS_getFormsInfo_1200
* @tc.desc When the bundleName isn't exist, moduleName is exist, the form configuration
* information query fails (by Promise)
*/
it('FMS_getFormsInfo_1200_promise', 0, async function (done) {
console.log("FMS_getFormsInfo_1200_promise begin");
var promise = formManager.getFormsInfo(
"aaaaaaa",
"formmodule001",
);
promise.then((result) => {
console.log("FMS_getFormsInfo_1200_promise result:" + result);
expect(result).assertEqual(0);
console.log("FMS_getFormsInfo_1200_promise result end");
done();
}
);
setTimeout(function () {
console.info('=====================FMS_getFormsInfo_1200_promise==================end');
}, TIMEOUT)
})
/**
* @tc.name getFormsInfo test
* @tc.number FMS_getFormsInfo_1300
* @tc.desc When the bundleName is exist, moduleName is null, the form configuration information
* query fails (by AsyncCallback)
*/
it('FMS_getFormsInfo_1300_callback', 0, async function (done) {
console.log("FMS_getFormsInfo_1300_callback begin");
var ret = formManager.getFormsInfo(
"com.form.formsystemtestservicea",
"",
(result, data) => {
console.log("FMS_getFormsInfo_1300_callback getFormsInfo async::sucess, data json:"
+ JSON.stringify(data));
console.log("FMS_getFormsInfo_1300_callback async::result, result:" + result);
expect(result).assertEqual(0);
console.log("FMS_getFormsInfo_1300_callback result end");
done();
}
);
setTimeout(function () {
console.info('=====================FMS_getFormsInfo_1300_callback==================end');
}, TIMEOUT)
console.log("FMS_getFormsInfo_1300_callback end, ret:"+ret);
})
/**
* @tc.name getFormsInfo test
* @tc.number FMS_getFormsInfo_1300
* @tc.desc When the bundleName is exist, moduleName is null, the form configuration information
* query fails (by Promise)
*/
it('FMS_getFormsInfo_1300_promise', 0, async function (done) {
console.log("FMS_getFormsInfo_1300_promise begin");
var promise = formManager.getFormsInfo(
"com.form.formsystemtestservicea",
"",
);
promise.then((result) => {
console.log("FMS_getFormsInfo_1300_promise result:" + result);
expect(result).assertEqual(0);
console.log("FMS_getFormsInfo_1300_promise result end");
done();
}
);
setTimeout(function () {
console.info('=====================FMS_getFormsInfo_1300_promise==================end');
}, TIMEOUT)
})
/**
* @tc.name getFormsInfo test
* @tc.number FMS_getFormsInfo_1400
* @tc.desc When the bundleName is exist, moduleName is null, the form configuration information
* query fails (by AsyncCallback)
*/
it('FMS_getFormsInfo_1400_callback', 0, async function (done) {
console.log("FMS_getFormsInfo_1400_callback begin");
var ret = formManager.getFormsInfo(
"com.form.formsystemtestservicea",
"aaaaa",
(result, data) => {
console.log("FMS_getFormsInfo_1400_callback getFormsInfo async::sucess, data json:"
+ JSON.stringify(data));
console.log("FMS_getFormsInfo_1400_callback async::result, result:" + result);
expect(result).assertEqual(0);
console.log("FMS_getFormsInfo_1400_callback result end");
done();
}
);
setTimeout(function () {
console.info('=====================FMS_getFormsInfo_1400_callback==================end');
}, TIMEOUT)
console.log("FMS_getFormsInfo_1400_callback end, ret:"+ret);
})
/**
* @tc.name getFormsInfo test
* @tc.number FMS_getFormsInfo_1400
* @tc.desc When the bundleName is exist, moduleName is null, the form configuration information
* query fails (by Promise)
*/
it('FMS_getFormsInfo_1400_promise', 0, async function (done) {
console.log("FMS_getFormsInfo_1400_promise begin");
var promise = formManager.getFormsInfo(
"com.form.formsystemtestservicea",
"aaaaa",
);
promise.then((result) => {
console.log("FMS_getFormsInfo_1400_promise result:" + result);
expect(result).assertEqual(0);
console.log("FMS_getFormsInfo_1400_promise result end");
done();
}
);
setTimeout(function () {
console.info('=====================FMS_getFormsInfo_1400_promise==================end');
}, TIMEOUT)
})
/**
* @tc.name getFormsInfo test
* @tc.number FMS_getFormsInfo_1500
* @tc.desc When the bundleName and moduleName is exist, the form configuration information is
* queried successfully (by AsyncCallback).
*/
it('FMS_getFormsInfo_1500_callback', 0, async function (done) {
console.log("FMS_getFormsInfo_1500_callback begin");
var ret = formManager.getFormsInfo(
"com.form.formsystemtestservicea",
"formmodule001",
(result, data) => {
console.log("FMS_getFormsInfo_1500_callback getFormsInfo async::sucess, data json:"
+ JSON.stringify(data));
console.log("FMS_getFormsInfo_1500_callback async::result, result:" + result);
for(var i = 0; i < data.length; i++) {
expect(typeof (data[i].description)).assertEqual("string");
expect(data[i].description).assertEqual("form_description");
expect(data[i].type).assertEqual(1);
expect(data[i].jsComponentName).assertEqual("card");
expect(data[i].colorMode).assertEqual(-1);
expect(data[i].isDefault).assertEqual(1);
expect(data[i].updateEnabled).assertEqual(1);
expect(data[i].scheduledUpdateTime).assertEqual("0:0");
expect(data[i].formVisibleNotify).assertEqual(0);
expect(data[i].defaultDimension).assertEqual(1);
expect(data[i].supportDimensions[0]).assertEqual(1);
expect(data[i].supportDimensions[1]).assertEqual(2);
expect(data[i].metaData.customizeData[0].name).assertEqual("originWidgetName");
expect(data[i].metaData.customizeData[0].value).assertEqual("myTest");
}
expect(data[0].name).assertEqual("Form_Js001");
expect(data[1].name).assertEqual("Form_Js002");
expect(data[0].updateDuration).assertEqual(0);
expect(data[1].updateDuration).assertEqual(1);
console.log("FMS_getFormsInfo_1500_callback result end");
done();
}
);
setTimeout(function () {
console.info('=====================FMS_getFormsInfo_1500_callback==================end');
}, TIMEOUT)
console.log("FMS_getFormsInfo_1500_callback end, ret:"+ret);
})
/**
* @tc.name getFormsInfo test
* @tc.number FMS_getFormsInfo_1500
* @tc.desc When the bundleName and moduleName is exist, the form configuration information is
* queried successfully (by Promise)
*/
it('FMS_getFormsInfo_1500_promise', 0, async function (done) {
console.log("FMS_getFormsInfo_1500_promise begin");
var promise = formManager.getFormsInfo(
"com.form.formsystemtestservicea",
"formmodule001",
);
promise.then((data) => {
console.log("FMS_getFormsInfo_1500_promise async::sucess, data json:" + JSON.stringify(data));
for(var i = 0; i < data.length; i++) {
expect(typeof (data[i].description)).assertEqual("string");
expect(data[i].description).assertEqual("form_description");
expect(data[i].type).assertEqual(1);
expect(data[i].jsComponentName).assertEqual("card");
expect(data[i].colorMode).assertEqual(-1);
expect(data[i].isDefault).assertEqual(1);
expect(data[i].updateEnabled).assertEqual(1);
expect(data[i].scheduledUpdateTime).assertEqual("0:0");
expect(data[i].formVisibleNotify).assertEqual(0);
expect(data[i].defaultDimension).assertEqual(1);
expect(data[i].supportDimensions[0]).assertEqual(1);
expect(data[i].supportDimensions[1]).assertEqual(2);
expect(data[i].metaData.customizeData[0].name).assertEqual("originWidgetName");
expect(data[i].metaData.customizeData[0].value).assertEqual("myTest");
}
expect(data[0].name).assertEqual("Form_Js001");
expect(data[1].name).assertEqual("Form_Js002");
expect(data[0].updateDuration).assertEqual(0);
expect(data[1].updateDuration).assertEqual(1);
console.log("FMS_getFormsInfo_1500_promise result end");
done();
});
setTimeout(function () {
console.info('=====================FMS_getFormsInfo_1500_promise==================end');
}, 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.
*/
require('./GetAllFormsInfoJsunit.test.js')
\ No newline at end of file
{
"string": [
{
"name": "entry_MainAbility",
"value": "GetAllFormsInfo"
},
{
"name": "mainability_description",
"value": "JS_Empty 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsFormSystemTestServiceA") {
hap_profile = "./formmodule001/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsFormSystemTestServiceA"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./formmodule001/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./formmodule001/src/main/resources" ]
hap_profile = "./formmodule001/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "60000",
"package": "com.form.formsystemtestservicea",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsFormSystemTestserviceA.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "PushKit",
"push": [
"formsystemtestservicea001.hap->/data/formsystemtestservicea001.hap"
]
}
]
}
{
"app": {
"bundleName": "com.form.formsystemtestservicea",
"vendor": "ohos",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.form.formsystemtestservicea",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "formmodule001",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"visible": true,
"name": "FormStServiceAbilityA",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:entry_MainAbility",
"type": "service",
"launchType": "standard",
"formsEnabled": true,
"srcLanguage": "c++",
"forms": [
{
"name": "Form_Js001",
"description": "form_description",
"isDefault": true,
"type": "JS",
"colorMode": "auto",
"supportDimensions":[ "1*2", "2*2" ],
"defaultDimension": "1*2",
"updateEnabled": true,
"scheduledUpdateTime": "10:30",
"jsComponentName": "card",
"formVisibleNotify" : true,
"metaData": {
"customizeData": [
{
"name": "originWidgetName",
"value": "myTest"
}
]
}
},
{
"name": "Form_Js002",
"description": "form_description",
"isDefault": true,
"type": "JS",
"colorMode": "auto",
"supportDimensions":[ "1*2", "2*2" ],
"defaultDimension": "1*2",
"updateEnabled": true,
"updateDuration": 1,
"jsComponentName": "card",
"formVisibleNotify" : true,
"metaData": {
"customizeData": [
{
"name": "originWidgetName",
"value": "myTest"
}
]
}
}
]
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": true
}
}
]
}
}
\ 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 Subscriber from '@ohos.commonevent'
export default {
constructor(obj) {
console.log('formSystemTestServiceA: constructor ok, time stamp:'+ Date.parse(new Date()));
Subscriber.publish(
"fms_serviceA_constructor",
(err,data) => {
console.log("formSystemTestServiceA: constructor publish callback return! ")
}
);
},
updateData(obj) {
console.log('formSystemTestServiceA: updateData ok, time stamp:'+ Date.parse(new Date()));
Subscriber.publish(
"fms_serviceA_updateData",
(err,data) => {
console.log("formSystemTestServiceA: updateData publish callback return! ")
}
);
},
getDataString() {
console.log('formSystemTestServiceA: getDataString ok, time stamp:'+ Date.parse(new Date()));
Subscriber.publish(
"fms_serviceA_getDataString",
(err,data) => {
console.log("formSystemTestServiceA: getDataString publish callback return! ")
}
);
return "dataString";
},
addImageData(name, data){
console.log('formSystemTestServiceA: addImageData ok, time stamp:'+ Date.parse(new Date()));
Subscriber.publish(
"fms_serviceA_addImageData",
(err,data) => {
console.log("formSystemTestServiceA: addImageData publish callback return! ")
}
);
},
removeImageData(name){
console.log('formSystemTestServiceA: removeImageData ok, time stamp:'+ Date.parse(new Date()));
Subscriber.publish(
"fms_serviceA_removeImageData",
(err,data) => {
console.log("formSystemTestServiceA: removeImageData publish callback return! ")
}
);
},
onCreate(para) {
console.log('formSystemTestServiceA: onCreate ok, para:'+ para + ', time stamp:'+ Date.parse(new Date()));
Subscriber.publish(
"fms_serviceA_onCreate",
(err,data) => {
console.log("formSystemTestServiceA: onCreate publish callback return! ")
}
);
return {"city":"beijingA"};
},
onDestroy(para) {
console.log('formSystemTestServiceA: onDestroy para:'+ para + ', time stamp:'+ Date.parse(new Date()));
Subscriber.publish(
"fms_serviceA_onDestroy",
(err,data) => {
console.log("formSystemTestServiceA: onDestroy publish callback return! ")
}
);
},
onDelete(formId) {
console.log('formSystemTestServiceA: onDelete ok, formId:' + formId +
', time stamp:'+ Date.parse(new Date()));
Subscriber.publish(
"fms_serviceA_onDelete",
(err,data) => {
console.log("formSystemTestServiceA: onDelete publish callback return! ")
}
);
},
onTriggerEvent(formId, message) {
console.log('formSystemTestServiceA: onTriggerEvent ok, formId:' + formId
+ ', message:' + message + ', time stamp:'+ Date.parse(new Date()));
Subscriber.publish(
"fms_serviceA_onTriggerEvent",
(err,data) => {
console.log("formSystemTestServiceA: onTriggerEvent publish callback return! ")
}
);
},
onUpdate(formId) {
console.log('formSystemTestServiceA: onUpdate ok, formId:' + formId +
', time stamp:'+ Date.parse(new Date()));
Subscriber.publish(
"fms_serviceA_onUpdate",
(err,data) => {
console.log("formSystemTestServiceA: onUpdate publish callback return! ")
}
);
},
onCastTemp(formId) {
console.log('formSystemTestServiceA: onCastTemp ok, formId:' + formId +
', time stamp:'+ Date.parse(new Date()));
Subscriber.publish(
"fms_serviceA_onCastTemp",
(err,data) => {
console.log("formSystemTestServiceA: onCastTemp publish callback return! ")
}
);
},
onVisibilityChanged(formEventsMap) {
console.log('formSystemTestServiceA: OnVisibilityChanged ok, map:'+ formEventsMap +
', time stamp:'+ Date.parse(new Date()));
Subscriber.publish(
"fms_serviceA_onVisibilityChanged",
(err,data) => {
console.log("formSystemTestServiceA: onVisibilityChanged publish callback return! ")
}
);
},
onAcquireState(want) {
console.log('formSystemTestServiceA: OnAcquireState ok, '+ 'want.abilityName:' + want.abilityName +
', want.bundleName:' + want.bundleName + ', time stamp:'+ Date.parse(new Date()));
Subscriber.publish(
"fms_serviceA_onAcquireState",
(err,data) => {
console.log("formSystemTestServiceA: onAcquireState publish callback return! ")
}
);
}
};
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 40px;
color: #000000;
opacity: 0.9;
}
@media screen and (device-type: tablet) and (orientation: landscape) {
.title {
font-size: 100px;
}
}
@media screen and (device-type: wearable) {
.title {
font-size: 28px;
color: #FFFFFF;
}
}
@media screen and (device-type: tv) {
.container {
background-image: url("../../common/images/Wallpaper.png");
background-size: cover;
background-repeat: no-repeat;
background-position: center;
}
.title {
font-size: 100px;
color: #FFFFFF;
}
}
@media screen and (device-type: phone) and (orientation: landscape) {
.title {
font-size: 60px;
}
}
<div class="container">
<text class="title">
{{ $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.
*/
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
}
}
{
"string": [
{
"name": "entry_MainAbility",
"value": "A_fms"
},
{
"name": "mainability_description",
"value": "JS_Empty Ability"
}
]
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册