提交 a693864e 编写于 作者: Z zhaoyuan17@huawei.com
上级 971b4768
......@@ -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/FormFuzzTest:FormFuzzTest",
"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("FormFuzzTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "FormFuzzTest"
}
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.formfuzztest",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"FormFuzzTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "ShellKit",
"run-command": [
"remount",
"mkdir /system/vendor"
]
},
{
"type": "PushKit",
"push": [
"FormFuzzTest.hap->/data/FormFuzzTest.hap"
]
},
{
"type": "ShellKit",
"run-command": [
"chmod 644 /system/vendor/*.hap"
]
}
]
}
{
"app": {
"bundleName": "com.example.formfuzztest",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.formfuzztest",
"name": ".MyApplication",
"mainAbility": "com.example.formfuzztest.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.formfuzztest.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
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 = "FMS Fuzz Test";
},
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('./FormFuzzTest.test.js')
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
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;
var OBJECT_RANDOM_LENGTH = 2;
var FUNCTION_RANDOM_LENGTH = 2;
//string ascii
var STRING_RANDOM_LENGTH_A = 48;
var STRING_RANDOM_LENGTH_B = 58;
var STRING_RANDOM_LENGTH_C = 65;
var STRING_RANDOM_LENGTH_D = 91;
var STRING_RANDOM_LENGTH_E = 97;
var STRING_RANDOM_LENGTH_F = 122;
// Return integer random, the range is: [iStart, iEnd)
function getIntegerRandom(iStart, iEnd) {
var decimal = iStart + (iEnd - iStart) * Math.random();
return Math.floor(decimal);
}
// return string random, the string length is: [0, 2064)
const stringTest = function() {
// string
var res = "";
// string length
var iNumber = getIntegerRandom(RANDOM_BEGIN_POSITION, STRING_RANDOM_LENGTH);
for(var iAsciiToChar = RANDOM_BEGIN_POSITION; iAsciiToChar < iNumber ; iAsciiToChar ++) {
var iNumberString = getIntegerRandom(RANDOM_BEGIN_POSITION, RANDOM_BEGIN_POSITION_A);
switch (iNumberString) {
case 0:
// get ascii [0-9]
iNumber = getIntegerRandom(STRING_RANDOM_LENGTH_A, STRING_RANDOM_LENGTH_B);
break;
case 1:
// get ascii [A-Z]
iNumber = getIntegerRandom(STRING_RANDOM_LENGTH_C, STRING_RANDOM_LENGTH_D);
break;
case 2:
default:
// get ascii [a-z]
iNumber = getIntegerRandom(STRING_RANDOM_LENGTH_E, STRING_RANDOM_LENGTH_F);
break;
}
// from ascii to char
var asciiToChar = String.fromCharCode(iNumber);
res += asciiToChar;
}
return res;
}
// return number random, the number length is: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER]
const numberTest = function() {
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);
}
// return null
const nullTest = function() {
return null;
}
// return undefinedTest
const undefinedTest = function() {
return undefined;
}
// return array random, the array value is: string,number,bool
const arrayTest = function() {
var arrValue = [];
// array length
var iNumber = getIntegerRandom(RANDOM_BEGIN_POSITION, ARRAY_RANDOM_LENGTH);
for(var iArrNumber = 0; iArrNumber < iNumber ; iArrNumber ++) {
// string,number,bool
iNumber = getIntegerRandom(RANDOM_BEGIN_POSITION, ARRAY_RANDOM_TYPE_LENGTH);
switch(iNumber) {
case 0:
arrValue[iArrNumber] = stringTest();
break;
case 1:
arrValue[iArrNumber] = numberTest();
break;
case 2:
arrValue[iArrNumber] = booleanTest();
break;
default:
arrValue[iArrNumber] = '';
}
}
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");
return getIntegerRandom(RANDOM_BEGIN_POSITION, OBJECT_RANDOM_LENGTH) ? objectA: objectB;
}
// return functionTest random, the functionTest value is: null, not null
const functionTest = function() {
var functionA = {};
var functionB = {id:"functionTest"};
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
}
\ No newline at end of file
{
"string": [
{
"name": "entry_MainAbility",
"value": "fuzztest"
},
{
"name": "mainability_description",
"value": "JS_Empty Ability"
},
{
"name": "testForm",
"value": "REQUIRE_FORM permission"
},
{
"name": "testFormA",
"value": "CAMERA permission"
}
]
}
\ 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("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.
*/
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
# 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("ActsFormSystemTestServiceB") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsFormSystemTestServiceB"
}
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"
}
{
"app": {
"bundleName": "com.form.formsystemtestserviceb",
"vendor": "neusoft",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 5,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.form.formsystemtestserviceb",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "formmodule001",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"visible": true,
"name": "com.form.formmodule001.FormAbility001",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:entry_MainAbility",
"type": "service",
"launchType": "standard",
"formsEnabled": true,
"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"
}
]
}
}
]
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": true
}
}
]
}
}
\ No newline at end of file
import Subscriber from '@ohos.commonevent'
var JSON_DATA_COUNT = 200;
export default {
constructor(obj) {
console.log('formSystemTestServiceB: constructor ok, time stamp:'+ Date.parse(new Date()));
// Subscriber.publish(
// "fms_serviceA_constructor",
// (err,data) => {
// console.log("formSystemTestServiceB: constructor publish callback return! ")
// }
// );
},
updateData(obj) {
console.log('formSystemTestServiceB: updateData ok, time stamp:'+ Date.parse(new Date()));
// Subscriber.publish(
// "fms_serviceA_updateData",
// (err,data) => {
// console.log("formSystemTestServiceB: updateData publish callback return! ")
// }
// );
},
getDataString() {
console.log('formSystemTestServiceB: getDataString ok, time stamp:'+ Date.parse(new Date()));
// Subscriber.publish(
// "fms_serviceA_getDataString",
// (err,data) => {
// console.log("formSystemTestServiceB: getDataString publish callback return! ")
// }
// );
return "dataString";
},
addImageData(name, data){
console.log('formSystemTestServiceB: addImageData ok, time stamp:'+ Date.parse(new Date()));
// Subscriber.publish(
// "fms_serviceA_addImageData",
// (err,data) => {
// console.log("formSystemTestServiceB: addImageData publish callback return! ")
// }
// );
},
removeImageData(name){
console.log('formSystemTestServiceB: removeImageData ok, time stamp:'+ Date.parse(new Date()));
// Subscriber.publish(
// "fms_serviceA_removeImageData",
// (err,data) => {
// console.log("formSystemTestServiceB: removeImageData publish callback return! ")
// }
// );
},
onCreate(para) {
console.log('formSystemTestServiceB: onCreate ok, para:'+ para + ', time stamp:'+ Date.parse(new Date()));
// Subscriber.publish(
// "fms_serviceA_onCreate",
// (err,data) => {
// console.log("formSystemTestServiceB: onCreate publish callback return! ")
// }
// );
// return {"city":"beijing","city2":"beijing2","city3":"beijing3","city4":"beijing4","city5":"beijing5",
// "city6":"beijing6","city7":"beijing7","city8":"beijing8","city9":"beijing9","city10":"beijing10",
// "city12":"beijing12","city13":"beijing13","city14":"beijing14","city15":"beijing15",
// "city22":"beijing22","city23":"beijing23","city24":"beijing24","city25":"beijing25",
// "city32":"beijing32","city33":"beijing33","city34":"beijing34","city35":"beijing35",
// "city42":"beijing42","city43":"beijing43","city44":"beijing44","city45":"beijing45",
// "city52":"beijing52","city53":"beijing53","city54":"beijing54","city55":"beijing55",
// "city62":"beijing62","city63":"beijing63","city64":"beijing64","city65":"beijing65",
// "city72":"beijing72","city73":"beijing73","city74":"beijing74","city75":"beijing75",
// "city82":"beijing82","city83":"beijing83","city84":"beijing84","city85":"beijing85",
// "city92":"beijing92","city93":"beijing93","city94":"beijing94","city95":"beijing95",
// "city11":"beijing16","city17":"beijing18","city19":"beijing110","city11":"beijing111",
// "city21":"beijing26","city27":"beijing28","city29":"beijing210","city211":"beijing211",
// "city31":"beijing36","city37":"beijing38","city39":"beijing310","city311":"beijing311",
// "city41":"beijing46","city47":"cdbeijing48","city49":"beijing410","city11":"beijing411"
// };
var jsonData = "{";
for (var iJsonDataCount = 0; iJsonDataCount < JSON_DATA_COUNT; iJsonDataCount++) {
jsonData = jsonData + "city" + iJsonDataCount + ":" + "beijingB"+iJsonDataCount;
if ( iJsonDataCount != JSON_DATA_COUNT - 1) {
jsonData = jsonData + ", ";
}
}
jsonData = jsonData + "}";
return jsonData;
},
onDestroy(para) {
console.log('formSystemTestServiceB: onDestroy para:'+ para + ', time stamp:'+ Date.parse(new Date()));
// Subscriber.publish(
// "fms_serviceA_onDestroy",
// (err,data) => {
// console.log("formSystemTestServiceB: onDestroy publish callback return! ")
// }
// );
},
onDelete(formId) {
console.log('formSystemTestServiceB: onDelete ok, formId:' + formId + ', time stamp:'+ Date.parse(new Date()));
// Subscriber.publish(
// "fms_serviceA_onDelete",
// (err,data) => {
// console.log("formSystemTestServiceB: onDelete publish callback return! ")
// }
// );
},
onTriggerEvent(formId, message) {
console.log('formSystemTestServiceB: onTriggerEvent ok, formId:' + formId + 'message:' + message + ', time stamp:'+ Date.parse(new Date()));
// Subscriber.publish(
// "fms_serviceA_onTriggerEvent",
// (err,data) => {
// console.log("formSystemTestServiceB: onTriggerEvent publish callback return! ")
// }
// );
},
onUpdate(formId) {
console.log('formSystemTestServiceB: onUpdate ok, formId:' + formId + ', time stamp:'+ Date.parse(new Date()));
// Subscriber.publish(
// "fms_serviceA_onUpdate",
// (err,data) => {
// console.log("formSystemTestServiceB: onUpdate publish callback return! ")
// }
// );
},
onCastTemp(formId) {
console.log('formSystemTestServiceB: onCastTemp ok, formId:' + formId + ', time stamp:'+ Date.parse(new Date()));
// Subscriber.publish(
// "fms_serviceA_onCastTemp",
// (err,data) => {
// console.log("formSystemTestServiceB: onCastTemp publish callback return! ")
// }
// );
},
onVisibilityChanged(formEventsMap) {
console.log('formSystemTestServiceB: OnVisibilityChanged ok, map:'+ formEventsMap + ', time stamp:'+ Date.parse(new Date()));
// Subscriber.publish(
// "fms_serviceA_onVisibilityChanged",
// (err,data) => {
// console.log("formSystemTestServiceB: onVisibilityChanged publish callback return! ")
// }
// );
},
onAcquireState(want) {
console.log('formSystemTestServiceB: 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("formSystemTestServiceB: onAcquireState publish callback return! ")
// }
// );
}
};
\ 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>
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
}
}
{
"string": [
{
"name": "entry_MainAbility",
"value": "formSystemTestServiceB"
},
{
"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.
先完成此消息的编辑!
想要评论请 注册