提交 57611c60 编写于 作者: O openharmony_ci 提交者: Gitee

!1061 FMS ST

Merge pull request !1061 from blackleon/master_fms
......@@ -17,9 +17,15 @@ group("formmanager") {
testonly = true
if (is_standard_system) {
deps = [
#"formsystemtesthost/FormFuzzTest:FormFuzzTest",
#"formsystemtesthost/getallformsinfo:GetAllFormsInfo",
#"formsystemtestservice/formsystemtestservicea:ActsFormSystemTestServiceA",
"formsystemtesthost/FormFuzzTest:FormFuzzTest",
"formsystemtesthost/getallformsinfo10:GetAllFormsInfo10",
"formsystemtesthost/getallformsinfo201:GetAllFormsInfo201",
"formsystemtesthost/getallformsinfo211:GetAllFormsInfo211",
"formsystemtesthost/getallformsinfo212:GetAllFormsInfo212",
"formsystemtestservice/formsystemtestservicea:ActsFormSystemTestServiceA",
"formsystemtestservice/formsystemtestserviceb:ActsFormSystemTestServiceB",
"formsystemtestservice/formsystemtestservicec:ActsFormSystemTestServiceC",
"formsystemtestservice/formsystemtestserviced:ActsFormSystemTestServiceD",
]
}
}
......@@ -2,7 +2,7 @@
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "240000",
"test-timeout": "360000",
"package": "com.example.formfuzztest",
"shell-timeout": "60000"
},
......
......@@ -13,4 +13,11 @@
* limitations under the License.
*/
require('./FormFuzzTest.test.js')
\ No newline at end of file
require('./FormFuzzTestArray.test.js')
require('./FormFuzzTestBool.test.js')
require('./FormFuzzTestFunction.test.js')
require('./FormFuzzTestNull.test.js')
require('./FormFuzzTestNum.test.js')
require('./FormFuzzTestObject.test.js')
require('./FormFuzzTestString.test.js')
require('./FormFuzzTestUndefined.test.js')
\ No newline at end of file
......@@ -15,7 +15,6 @@
var RANDOM_BEGIN_POSITION = 0;
var RANDOM_BEGIN_POSITION_A = 2;
var STRING_RANDOM_LENGTH = 2064;
var ASCII_RANDOM_LENGTH = 256;
var BOOLEAN_RANDOM_LENGTH = 2;
var ARRAY_RANDOM_LENGTH = 10;
var ARRAY_RANDOM_TYPE_LENGTH = 3;
......@@ -67,26 +66,31 @@ const stringTest = function() {
var asciiToChar = String.fromCharCode(iNumber);
res += asciiToChar;
}
console.log("The stringTest of this fuzzTest random:" + res);
return res;
}
// return number random, the number length is: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER]
const numberTest = function() {
console.log("The numberTest of this fuzzTest random" );
return getIntegerRandom(Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER + 1);
}
// return boolean random, the boolean value is: 0->(false), 1->(true)
const booleanTest = function() {
return getIntegerRandom(RANDOM_BEGIN_POSITION, BOOLEAN_RANDOM_LENGTH);
console.log("The booleanTest of this fuzzTest random" );
return Boolean(getIntegerRandom(RANDOM_BEGIN_POSITION, BOOLEAN_RANDOM_LENGTH));
}
// null
const nullTest = function() {
console.log("The nullTest of this fuzzTest random" );
return null;
}
// undefinedTest
// undefined
const undefinedTest = function() {
console.log("The undefinedTest of this fuzzTest random" );
return undefined;
}
......@@ -114,14 +118,17 @@ const arrayTest = function() {
arrValue[iArrNumber] = '';
}
}
console.log("The arrayTest of this fuzzTest random:" + arrValue);
return arrValue;
}
// return objectTest random, the objectTest value is: null, not null
const objectTest = function() {
var objectA = Object.create(null);
var objectB = Object.create("objectTest");
var objectA = {};
var objectb = {id : 'objectTest'};
var objectB = Object.create(objectb);
console.log("The objectTest of this fuzzTest random" );
return getIntegerRandom(RANDOM_BEGIN_POSITION, OBJECT_RANDOM_LENGTH) ? objectA: objectB;
}
......@@ -130,67 +137,10 @@ const functionTest = function() {
var functionA = {};
var functionB = {id:"functionTest"};
console.log("The functionTest of this fuzzTest random" );
return getIntegerRandom(RANDOM_BEGIN_POSITION, FUNCTION_RANDOM_LENGTH) ? functionA: functionB;
}
// get parameter value from: string, number, bool, null, undefined, object, array, function
const parameterValue = function() {
var fuzzConfigData = [
{"name":"string", "paramWeight":25},{"name":"number", "paramWeight":45},{"name":"boolean", "paramWeight":50},
{"name":"null", "paramWeight":52},{"name":"undefined", "paramWeight":54},{"name":"object", "paramWeight":62},
{"name":"array", "paramWeight":92},{"name":"function", "paramWeight":100},
]
var weightSum = fuzzConfigData[fuzzConfigData.length - 1].paramWeight;
console.log("The weight sum of this fuzzTest:" + weightSum);
var paramValue = '';
var iNumber = getIntegerRandom(RANDOM_BEGIN_POSITION, weightSum);
console.log("The iNumber of this fuzzTest random:" + iNumber);
for(var iFuzzDataNumber = 0; iFuzzDataNumber < fuzzConfigData.length; iFuzzDataNumber ++) {
if((iFuzzDataNumber == 0 && iNumber < fuzzConfigData[iFuzzDataNumber].paramWeight) ||
(iNumber < fuzzConfigData[iFuzzDataNumber].paramWeight &&
iNumber > fuzzConfigData[iFuzzDataNumber - 1].paramWeight) ) {
console.log("The name of this fuzzTest random:" + fuzzConfigData[iFuzzDataNumber].name);
switch(fuzzConfigData[iFuzzDataNumber].name) {
case "string":
paramValue = stringTest();
break;
case "number":
paramValue = numberTest();
break;
case "boolean":
paramValue = booleanTest();
break;
case "null":
paramValue = nullTest();
break;
case "undefined":
paramValue = undefinedTest();
break;
case "object":
paramValue = objectTest();
break;
case "array":
paramValue = arrayTest();
break;
case "function":
paramValue = functionTest();
break;
default:
paramValue = '';
break;
}
}
}
console.log("The paramValue of this fuzzTest random:" + paramValue);
return paramValue;
}
export {
parameterValue, stringTest, numberTest, booleanTest, nullTest, undefinedTest, objectTest, arrayTest, functionTest
stringTest, numberTest, booleanTest, nullTest, undefinedTest, objectTest, arrayTest, functionTest
}
\ No newline at end of file
......@@ -13,14 +13,14 @@
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("GetAllFormsInfo") {
ohos_js_hap_suite("GetAllFormsInfo10") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "GetAllFormsInfo"
hap_name = "GetAllFormsInfo10"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
......
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "60000",
"package": "com.example.getallformsinfo10",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"GetAllFormsInfo10.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "ShellKit",
"run-command": [
"remount",
"mkdir /system/vendor"
]
},
{
"type": "PushKit",
"push": [
"GetAllFormsInfo10.hap->/data/GetAllFormsInfo10.hap"
]
},
{
"type": "ShellKit",
"run-command": [
"chmod 644 /system/vendor/*.hap"
]
}
]
}
{
"app": {
"bundleName": "com.example.getallformsinfo10",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.getallformsinfo10",
"name": ".MyApplication",
"mainAbility": "com.example.getallformsinfo10.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.getallformsinfo10.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard"
}
],
"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 formManager from '@ohos.ability.formManager'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
const TIMEOUT = 3000;
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 empty (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(0);
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 empty (by Promise)
*/
it('FMS_getFormsInfo_0300_promise', 0, async function (done) {
console.log("FMS_getFormsInfo_0300_promise begin");
var promise = formManager.getAllFormsInfo();
promise.then((result) => {
console.log("FMS_getFormsInfo_0300_promise result:" + result);
expect(result).assertEqual(0);
console.log("FMS_getFormsInfo_0300_promise result end");
done();
}
);
setTimeout(function () {
console.info('=====================FMS_getFormsInfo_0300_promise==================end');
}, TIMEOUT)
})
})
......@@ -13,4 +13,4 @@
* limitations under the License.
*/
require('./GetAllFormsInfoJsunit.test.js')
\ No newline at end of file
require('./GetAllFormsInfo10Jsunit.test.js')
\ No newline at end of file
{
"string": [
{
"name": "entry_MainAbility",
"value": "GetAllFormsInfo10"
},
{
"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("GetAllFormsInfo201") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "GetAllFormsInfo201"
}
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": "60000",
"package": "com.example.getallformsinfo201",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"GetAllFormsInfo201.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "ShellKit",
"run-command": [
"remount",
"mkdir /system/vendor"
]
},
{
"type": "PushKit",
"push": [
"GetAllFormsInfo201.hap->/data/GetAllFormsInfo201.hap"
]
},
{
"type": "ShellKit",
"run-command": [
"chmod 644 /system/vendor/*.hap"
]
}
]
}
{
"app": {
"bundleName": "com.example.getallformsinfo201",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.getallformsinfo201",
"name": ".MyApplication",
"mainAbility": "com.example.getallformsinfo201.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.getallformsinfo201.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard"
}
],
"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');
}
};
.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;
}
}
/*
* 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 = 3000;
describe('getAllFormsInfoTest', function () {
console.log("system application and has permissions Test");
/**
* @tc.name getAllFormsInfo test
* @tc.number FMS_getFormsInfo_0400
* @tc.desc All form configuration information is queried successfully (by AsyncCallback)
*/
it('FMS_getFormsInfo_0400_callback', 0, async function (done) {
console.log("FMS_getFormsInfo_0400_callback begin");
var ret = formManager.getAllFormsInfo(
(result, data) => {
console.log("FMS_getFormsInfo_0400_callback async::sucess, data json:"
+ JSON.stringify(data));
console.log("FMS_getFormsInfo_0400_callback async::result, result:" + result);
expect(result).assertEqual(1);
expect(data[0].description).assertEqual("form_description");
expect(data[0].type).assertEqual(1);
expect(data[0].colorMode).assertEqual(-1);
expect(data[0].jsComponentName).assertEqual("card");
expect(data[0].isDefault).assertEqual(1);
expect(data[0].updateEnabled).assertEqual(1);
expect(data[0].updateDuration).assertEqual(1);
expect(data[0].scheduledUpdateTime).assertEqual("10:30");
expect(data[0].formVisibleNotify).assertEqual(1);
expect(data[0].defaultDimension).assertEqual(1);
expect(data[0].supportDimensions[0]).assertEqual(1);
expect(data[0].supportDimensions[1]).assertEqual(2);
expect(data[0].metaData.customizeData[0].name).assertEqual("originWidgetName");
expect(data[0].metaData.customizeData[0].value).assertEqual("myTest");
expect(data[0].name).assertEqual("FormB_Js001");
console.log("FMS_getFormsInfo_0400_callback result end");
done();
}
);
setTimeout(function () {
console.info('=====================FMS_getFormsInfo_0400_callback==================end');
}, TIMEOUT)
console.log("FMS_getFormsInfo_0400_callback end, ret:"+ret);
})
/**
* @tc.name getAllFormsInfo test
* @tc.number FMS_getFormsInfo_0400
* @tc.desc All form configuration information is queried successfully (by Promise)
*/
it('FMS_getFormsInfo_0400_promise', 0, async function (done) {
console.log("FMS_getFormsInfo_0400_promise begin--------111");
var promise = formManager.getAllFormsInfo();
promise.then((data) => {
console.log("FMS_getFormsInfo_0400_promise async::sucess, data json:" + JSON.stringify(data));
expect(data[0].description).assertEqual("form_description");
expect(data[0].type).assertEqual(1);
expect(data[0].colorMode).assertEqual(-1);
expect(data[0].jsComponentName).assertEqual("card");
expect(data[0].isDefault).assertEqual(1);
expect(data[0].updateEnabled).assertEqual(1);
expect(data[0].updateDuration).assertEqual(1);
expect(data[0].scheduledUpdateTime).assertEqual("10:30");
expect(data[0].formVisibleNotify).assertEqual(1);
expect(data[0].defaultDimension).assertEqual(1);
expect(data[0].supportDimensions[0]).assertEqual(1);
expect(data[0].supportDimensions[1]).assertEqual(2);
expect(data[0].metaData.customizeData[0].name).assertEqual("originWidgetName");
expect(data[0].metaData.customizeData[0].value).assertEqual("myTest");
expect(data[0].name).assertEqual("FormB_Js001");
console.log("FMS_getFormsInfo_0400_promise result end");
done();
}
);
setTimeout(function () {
console.info('=====================FMS_getFormsInfo_0400_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('./GetAllFormsInfo201Jsunit.test.js')
\ No newline at end of file
{
"string": [
{
"name": "entry_MainAbility",
"value": "GetAllFormsInfo201"
},
{
"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("GetAllFormsInfo211") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "GetAllFormsInfo211"
}
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": "60000",
"package": "com.example.getallformsinfo211",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"GetAllFormsInfo211.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "ShellKit",
"run-command": [
"remount",
"mkdir /system/vendor"
]
},
{
"type": "PushKit",
"push": [
"GetAllFormsInfo211.hap->/data/GetAllFormsInfo211.hap"
]
},
{
"type": "ShellKit",
"run-command": [
"chmod 644 /system/vendor/*.hap"
]
}
]
}
{
"app": {
"bundleName": "com.example.getallformsinfo211",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.getallformsinfo211",
"name": ".MyApplication",
"mainAbility": "com.example.getallformsinfo211.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.getallformsinfo211.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard"
}
],
"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 = 3000;
describe('getAllFormsInfoTest', function () {
console.log("system application and has permissions Test");
/**
* @tc.name getAllFormsInfo test
* @tc.number FMS_getFormsInfo_0500
* @tc.desc All form configuration information is queried successfully (by AsyncCallback)
*/
it('FMS_getFormsInfo_0500_callback', 0, async function (done) {
console.log("FMS_getFormsInfo_0500_callback begin");
var ret = formManager.getAllFormsInfo(
(result, data) => {
console.log("FMS_getFormsInfo_0500_callback async::sucess, data json:"
+ JSON.stringify(data));
console.log("FMS_getFormsInfo_0500_callback async::result, result:" + result);
expect(result).assertEqual(1);
for(var i = 0; i < data.length; i++) {
expect(data[i].description).assertEqual("form_description");
expect(data[i].type).assertEqual(1);
expect(data[i].colorMode).assertEqual(-1);
expect(data[i].jsComponentName).assertEqual("card");
expect(data[i].isDefault).assertEqual(1);
expect(data[i].updateEnabled).assertEqual(1);
expect(data[i].updateDuration).assertEqual(1);
expect(data[i].scheduledUpdateTime).assertEqual("10:30");
expect(data[i].formVisibleNotify).assertEqual(1);
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("FormB_Js001");
expect(data[1].name).assertEqual("FormC_Js001");
console.log("FMS_getFormsInfo_0500_callback result end");
done();
}
);
setTimeout(function () {
console.info('=====================FMS_getFormsInfo_0500_callback==================end');
}, TIMEOUT)
console.log("FMS_getFormsInfo_0500_callback end, ret:"+ret);
})
/**
* @tc.name getAllFormsInfo test
* @tc.number FMS_getFormsInfo_0500
* @tc.desc All form configuration information is queried successfully (by Promise)
*/
it('FMS_getFormsInfo_0500_promise', 0, async function (done) {
console.log("FMS_getFormsInfo_0500_promise begin--------111");
var promise = formManager.getAllFormsInfo();
promise.then((data) => {
console.log("FMS_getFormsInfo_0500_promise async::sucess, data json:" + JSON.stringify(data));
for(var i = 0; i < data.length; i++) {
expect(data[i].description).assertEqual("form_description");
expect(data[i].type).assertEqual(1);
expect(data[i].colorMode).assertEqual(-1);
expect(data[i].jsComponentName).assertEqual("card");
expect(data[i].isDefault).assertEqual(1);
expect(data[i].updateEnabled).assertEqual(1);
expect(data[i].updateDuration).assertEqual(1);
expect(data[i].scheduledUpdateTime).assertEqual("10:30");
expect(data[i].formVisibleNotify).assertEqual(1);
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("FormB_Js001");
expect(data[1].name).assertEqual("FormC_Js001");
console.log("FMS_getFormsInfo_0500_promise result end");
done();
}
);
setTimeout(function () {
console.info('=====================FMS_getFormsInfo_0500_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('./GetAllFormsInfo211Jsunit.test.js')
\ No newline at end of file
{
"string": [
{
"name": "entry_MainAbility",
"value": "GetAllFormsInfo211"
},
{
"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("GetAllFormsInfo212") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "GetAllFormsInfo212"
}
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"
}
......@@ -2,14 +2,14 @@
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "240000",
"test-timeout": "120000",
"package": "com.example.getallformsinfo",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"GetAllFormsInfo.hap"
"GetAllFormsInfo212.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
......@@ -24,7 +24,7 @@
{
"type": "PushKit",
"push": [
"GetAllFormsInfo.hap->/data/GetAllFormsInfo.hap"
"GetAllFormsInfo212.hap->/data/GetAllFormsInfo212.hap"
]
},
......
......@@ -47,33 +47,6 @@
"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": [
......
/*
* 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.
*/
require('./GetAllFormsInfo212Jsunit.test.js')
\ No newline at end of file
{
"string": [
{
"name": "entry_MainAbility",
"value": "GetAllFormsInfo212"
},
{
"name": "mainability_description",
"value": "JS_Empty Ability"
}
]
}
\ No newline at end of file
{
"description": "Configuration for hjunit demo Tests",
"description": "Configuration for hjunit demo Tests"
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册