diff --git a/aafwk/aafwk_standard/BUILD.gn b/aafwk/aafwk_standard/BUILD.gn index 11a5c15c95f9447213ddb1c16365d543a77a577b..c4769c6c185f80bf2b42fb07aa6ab5d4319a07d4 100644 --- a/aafwk/aafwk_standard/BUILD.gn +++ b/aafwk/aafwk_standard/BUILD.gn @@ -20,6 +20,7 @@ group("aafwk_standard") { "abilitymanager:actsabilitymanagertest", "context:context", "featureability:featureability", + "formmanager:formmanager", "want:want", ] } diff --git a/aafwk/aafwk_standard/formmanager/BUILD.gn b/aafwk/aafwk_standard/formmanager/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..fbf70c8f07ebfaa575befb1e80c12d30873c4d56 --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/BUILD.gn @@ -0,0 +1,26 @@ +# 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", + ] + } +} diff --git a/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/BUILD.gn b/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..c90113119fa64ec3e2262f0558f69481db079868 --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/BUILD.gn @@ -0,0 +1,31 @@ +# 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" +} diff --git a/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/Test.json b/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..49e7fd17e4f2ee1ab0518e52e74589a56d4ee788 --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/Test.json @@ -0,0 +1,38 @@ +{ + "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" + ] + } + ] +} diff --git a/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/entry/src/main/config.json b/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..547d41e6b81f48a282d534c46e5af6a85e7472b8 --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/entry/src/main/config.json @@ -0,0 +1,90 @@ +{ + "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 diff --git a/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..aedcefe0054c6e16c40491f4d1abc20a4dc1c6ef --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/entry/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/entry/src/main/js/default/common/images/Wallpaper.png b/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/entry/src/main/js/default/common/images/Wallpaper.png new file mode 100644 index 0000000000000000000000000000000000000000..60d4841a80eb20c63de74306cb7f8350d6a85c48 Binary files /dev/null and b/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/entry/src/main/js/default/common/images/Wallpaper.png differ diff --git a/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/entry/src/main/js/default/common/images/bg-tv.jpg b/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/entry/src/main/js/default/common/images/bg-tv.jpg new file mode 100644 index 0000000000000000000000000000000000000000..86fc07358eea5c1474bc833fca07c6d4d8698a89 Binary files /dev/null and b/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/entry/src/main/js/default/common/images/bg-tv.jpg differ diff --git a/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/entry/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/entry/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/entry/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..0a66102a6f5e70198f774f5fbf658e36c25cc235 --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,44 @@ +.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; + } +} diff --git a/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/entry/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..e3b6a650c7607506316405b7242b92bb6ff3715e --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,51 @@ +/* + * 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() { + }, +} diff --git a/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/entry/src/main/js/test/FormFuzzTest.test.js b/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/entry/src/main/js/test/FormFuzzTest.test.js new file mode 100644 index 0000000000000000000000000000000000000000..be4f411ed29c34c53508513fe4a5e88d9f32a496 --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/entry/src/main/js/test/FormFuzzTest.test.js @@ -0,0 +1,500 @@ +/* + * 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' +import {parameterValue, stringTest, numberTest, booleanTest, nullTest, undefinedTest, objectTest, arrayTest, functionTest} from './getParam.js' + +const TIMEOUT = 2000; +describe('formFuzzTest', function () { + console.log("formFuzzTest===start"); + + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_0200 + * @tc.desc Check whether the deleteForm interface can pass the fuzzy test (by AsyncCallback) + */ + it('FMS_fuzzTest_0200_callback', 0, async function (done) { + console.log("FMS_fuzzTest_0200_callback deleteForm begin"); + + var formId = parameterValue(); + console.log("FMS_fuzzTest_0200_callback deleteForm formId typeof:"+ typeof(formId)); + + try{ + formManager.deleteForm( + formId, // formId: number>0 ok + (err,data) => { + console.log("FMS_fuzzTest_0200_callback async::callbak return!!!") + console.log("FMS_fuzzTest_0200_callback async::sucess data:" + data); + console.log("FMS_fuzzTest_0200_callback async::error err:" + err); + expect(err).assertEqual(1); + done(); + } + ); + } catch (e) { + console.log("FMS_fuzzTest_0200_callback Exception caught:" + e); + expect(0).assertEqual(0); + } + + console.log("FMS_fuzzTest_0200_callback deleteForm end"); + done(); + setTimeout(function () { + console.info('=====================FMS_fuzzTest_0200_callback==================end'); + }, TIMEOUT) + }) + + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_0200 + * @tc.desc Check whether the deleteForm interface can pass the fuzzy test (by Promise) + */ + it('FMS_fuzzTest_0200_promise', 0, async function (done) { + console.log("FMS_fuzzTest_0200_promise deleteForm begin"); + + var formId = parameterValue(); + console.log("FMS_fuzzTest_0200_promise deleteForm formId typeof:"+ typeof(formId)); + + var retResult; + try{ + retResult = await Promise.all(await formManager.deleteForm(formId)); // formId: number>0 ok + console.log("FMS_fuzzTest_0200_promise async::sucess retResult:" + retResult); + expect(retResult).assertEqual(1); + done(); + } catch (e) { + console.log("FMS_fuzzTest_0200_promise Exception caught:" + e); + expect(0).assertEqual(0); + } + + console.log("FMS_fuzzTest_0200_promise deleteForm end"); + done(); + setTimeout(function () { + console.info('=====================FMS_fuzzTest_0200_promise==================end'); + }, TIMEOUT) + }) + + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_0300 + * @tc.desc Check whether the releaseForm interface can pass the fuzzy test (by AsyncCallback) + */ + it('FMS_fuzzTest_0300_param_01_callback', 0, async function (done) { + console.log("FMS_fuzzTest_0300_param_01_callback releaseForm begin"); + + var formId = parameterValue(); + console.log("FMS_fuzzTest_0300_param_01_callback releaseForm formId typeof:"+ typeof(formId)); + + var isReleaseCache = booleanTest(); + console.log("FMS_fuzzTest_0300_param_01_callback releaseForm isReleaseCache typeof:"+ typeof(isReleaseCache)); + + try{ + formManager.releaseForm( + formId, // formId: number>0 ok + isReleaseCache, // isReleaseCache: boolean ok + (err,data) => { + console.log("FMS_fuzzTest_0300_param_01_callback async::callbak return!!!") + console.log("FMS_fuzzTest_0300_param_01_callback async::sucess data:" + data); + console.log("FMS_fuzzTest_0300_param_01_callback async::error err:" + err); + expect(err).assertEqual(1); + done(); + } + ); + } catch (e) { + console.log("FMS_fuzzTest_0300_param_01_callback Exception caught:" + e); + expect(0).assertEqual(0); + } + + console.log("FMS_fuzzTest_0300_param_01_callback releaseForm end"); + done(); + setTimeout(function () { + console.info('=====================FMS_fuzzTest_0300_param_01_callback==================end'); + }, TIMEOUT) + }) + + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_0300 + * @tc.desc Check whether the releaseForm interface can pass the fuzzy test (by Promise) + */ + it('FMS_fuzzTest_0300_param_01_promise', 0, async function (done) { + console.log("FMS_fuzzTest_0300_param_01_promise releaseForm begin"); + + var formId = parameterValue(); + console.log("FMS_fuzzTest_0300_param_01_promise releaseForm formId typeof:"+ typeof(formId)); + + var isReleaseCache = booleanTest(); + console.log("FMS_fuzzTest_0300_param_01_promise releaseForm isReleaseCache typeof:"+ typeof(isReleaseCache)); + + var retResult; + try{ + retResult = await Promise.all(await formManager.releaseForm(formId, isReleaseCache)); // formId: number>0 ok, isReleaseCache: boolean + console.log("FMS_fuzzTest_0300_param_01_promise async::sucess retResult:" + retResult); + expect(retResult).assertEqual(1); + done(); + } catch (e) { + console.log("FMS_fuzzTest_0300_param_01_promise Exception caught:" + e); + expect(0).assertEqual(0); + } + + console.log("FMS_fuzzTest_0300_param_01_promise releaseForm end"); + done(); + setTimeout(function () { + console.info('=====================FMS_fuzzTest_0300_param_01_promise==================end'); + }, TIMEOUT) + }) + + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_0300 + * @tc.desc Check whether the releaseForm interface can pass the fuzzy test (by AsyncCallback) + */ + it('FMS_fuzzTest_0300_param_02_callback', 0, async function (done) { + console.log("FMS_fuzzTest_0300_param_02_callback releaseForm begin"); + + var formId = stringTest(); + console.log("FMS_fuzzTest_0300_param_02_callback releaseForm formId typeof:"+ typeof(formId) + ",formId:" + formId); + + var isReleaseCache = parameterValue(); + console.log("FMS_fuzzTest_0300_param_02_callback releaseForm isReleaseCache typeof:"+ typeof(isReleaseCache)); + + try{ + formManager.releaseForm( + formId, // formId: number>0 ok + isReleaseCache, // isReleaseCache: boolean ok + (err,data) => { + console.log("FMS_fuzzTest_0300_param_02_callback async::callbak return!!!") + console.log("FMS_fuzzTest_0300_param_02_callback async::sucess data:" + data); + console.log("FMS_fuzzTest_0300_param_02_callback async::error err:" + err); + expect(err).assertEqual(1); + done(); + } + + ); + } catch (e) { + console.log("FMS_fuzzTest_0300_param_02_callback Exception caught:" + e); + expect(0).assertEqual(0); + } + + console.log("FMS_fuzzTest_0300_param_02_callback releaseForm end"); + done(); + setTimeout(function () { + console.info('=====================FMS_fuzzTest_0300_param_02_callback==================end'); + }, TIMEOUT) + }) + + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_0300 + * @tc.desc Check whether the releaseForm interface can pass the fuzzy test (by Promise) + */ + it('FMS_fuzzTest_0300_param_02_promise', 0, async function (done) { + console.log("FMS_fuzzTest_0300_param_02_promise releaseForm begin"); + + var formId = stringTest(); + console.log("FMS_fuzzTest_0300_param_02_promise releaseForm formId typeof:"+ typeof(formId) + ",formId:" + formId); + + var isReleaseCache = parameterValue(); + console.log("FMS_fuzzTest_0300_param_02_promise releaseForm isReleaseCache typeof:"+ typeof(isReleaseCache)); + + var retResult; + try{ + retResult = await Promise.all(await formManager.releaseForm(formId, isReleaseCache)); // formId: number>0 ok, isReleaseCache: boolean + console.log("FMS_fuzzTest_0300_param_02_promise async::sucess retResult:" + retResult); + expect(retResult).assertEqual(1); + done(); + } catch (e) { + console.log("FMS_fuzzTest_0300_param_02_promise Exception caught:" + e); + expect(0).assertEqual(0); + } + + console.log("FMS_fuzzTest_0300_param_02_promise releaseForm end"); + done(); + setTimeout(function () { + console.info('=====================FMS_fuzzTest_0300_param_02_promise==================end'); + }, TIMEOUT) + }) + + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_1200 + * @tc.desc Check whether the getAllFormsInfo interface can pass the fuzzy test (by AsyncCallback) + */ + it('FMS_fuzzTest_1200_callback', 0, async function (done) { + console.log("FMS_fuzzTest_1200_callback getAllFormsInfo begin"); + + var testParam = parameterValue(); + console.log("FMS_fuzzTest_1200_callback getAllFormsInfo formIds typeof:"+ typeof(testParam)); + + try{ + formManager.getAllFormsInfo( + testParam, // formIds: array ok + (err,data) => { + console.log("FMS_fuzzTest_1200_callback async::callbak return!!!") + console.log("FMS_fuzzTest_1200_callback async::sucess data:" + data); + console.log("FMS_fuzzTest_1200_callback async::error err:" + err); + expect(err).assertEqual(1); + done(); + } + ); + } catch (e) { + console.log("FMS_fuzzTest_1200_callback Exception caught:" + e); + expect(0).assertEqual(0); + } + + console.log("FMS_fuzzTest_1200_callback getAllFormsInfo end"); + done(); + setTimeout(function () { + console.info('=====================FMS_fuzzTest_1200_callback==================end'); + }, TIMEOUT) + }) + + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_1200 + * @tc.desc Check whether the getAllFormsInfo interface can pass the fuzzy test (by Promise) + */ + it('FMS_fuzzTest_1200_promise', 0, async function (done) { + console.log("FMS_fuzzTest_1200_promise getAllFormsInfo begin"); + + var testParam = parameterValue(); + console.log("FMS_fuzzTest_1200_promise getAllFormsInfo formIds typeof:"+ typeof(testParam)); + + var retResult; + try{ + retResult = await Promise.all(await formManager.getAllFormsInfo(testParam)); + console.log("FMS_fuzzTest_1200_promise async::sucess retResult:" + retResult); + expect(retResult).assertEqual(1); + done(); + } catch (e) { + console.log("FMS_fuzzTest_1200_promise Exception caught:" + e); + expect(0).assertEqual(0); + } + + console.log("FMS_fuzzTest_1200_promise getAllFormsInfo end"); + done(); + setTimeout(function () { + console.info('=====================FMS_fuzzTest_1200_promise==================end'); + }, TIMEOUT) + }) + + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_1300 + * @tc.desc Check whether the form configuration information query interface of the specified package + * can pass the fuzzy test (by AsyncCallback) + */ + it('FMS_fuzzTest_1300_callback', 0, async function (done) { + console.log("FMS_fuzzTest_1300_callback getFormsInfoByApp begin"); + + var bundleName = parameterValue(); + console.log("FMS_fuzzTest_1300_callback getFormsInfoByApp bundleName typeof:"+ typeof(bundleName)); + + try{ + formManager.getFormsInfo( + bundleName, // bundleName string + (err,data) => { + console.log("FMS_fuzzTest_1300_callback async::callbak return!!!") + console.log("FMS_fuzzTest_1300_callback async::sucess data:" + data); + console.log("FMS_fuzzTest_1300_callback async::error err:" + err); + expect(err).assertEqual(1); + done(); + } + ); + } catch (e) { + console.log("FMS_fuzzTest_1300_callback Exception caught:" + e); + expect(0).assertEqual(0); + } + + console.log("FMS_fuzzTest_1300_callback getFormsInfoByApp end"); + done(); + setTimeout(function () { + console.info('=====================FMS_fuzzTest_1300_callback==================end'); + }, TIMEOUT) + }) + + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_1300 + * @tc.desc Check whether the form configuration information query interface of the specified package + * can pass the fuzzy test (by Promise) + */ + it('FMS_fuzzTest_1300_promise', 0, async function (done) { + console.log("FMS_fuzzTest_1300_promise getFormsInfoByApp begin"); + + var bundleName = parameterValue(); + console.log("FMS_fuzzTest_1300_promise getFormsInfoByApp bundleName typeof:"+ typeof(bundleName)); + + var retResult; + try{ + retResult = await Promise.all(await formManager.getFormsInfo(bundleName)); + console.log("FMS_fuzzTest_1300_promise async::sucess retResult:" + retResult); + expect(retResult).assertEqual(1); + done(); + } catch (e) { + console.log("FMS_fuzzTest_1300_promise Exception caught:" + e); + expect(0).assertEqual(0); + } + + console.log("FMS_fuzzTest_1300_promise getFormsInfoByApp end"); + done(); + setTimeout(function () { + console.info('=====================FMS_fuzzTest_1300_promise==================end'); + }, TIMEOUT) + }) + + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_1400 + * @tc.desc Check whether the form configuration information query interface of the specified module + * can pass the fuzzy test (by AsyncCallback) + */ + it('FMS_fuzzTest_1400_param_01_callback', 0, async function (done) { + console.log("FMS_fuzzTest_1400_param_01_callback getFormsInfoByModule begin"); + + var bundleName = parameterValue(); + console.log("FMS_fuzzTest_1400_param_01_callback getFormsInfoByModule bundleName typeof:"+ typeof(bundleName)); + + var moduleName = stringTest(); + console.log("FMS_fuzzTest_1400_param_01_callback getFormsInfoByModule moduleName typeof:"+ typeof(moduleName)); + + try{ + formManager.getFormsInfo( + bundleName, // bundleName string + moduleName,// moduleName string + (err,data) => { + console.log("FMS_fuzzTest_1400_param_01_callback async::callbak return!!!") + console.log("FMS_fuzzTest_1400_param_01_callback async::sucess data:" + data); + console.log("FMS_fuzzTest_1400_param_01_callback async::error err:" + err); + expect(err).assertEqual(1); + done(); + } + ); + } catch (e) { + console.log("FMS_fuzzTest_1400_param_01_callback Exception caught:" + e); + expect(0).assertEqual(0); + } + + console.log("FMS_fuzzTest_1400_param_01_callback getFormsInfoByModule end"); + done(); + setTimeout(function () { + console.info('=====================FMS_fuzzTest_1400_param_01_callback==================end'); + }, TIMEOUT) + }) + + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_1400 + * @tc.desc Check whether the form configuration information query interface of the specified module + * can pass the fuzzy test (by Promise) + */ + it('FMS_fuzzTest_1400_param_01_promise', 0, async function (done) { + console.log("FMS_fuzzTest_1400_param_01_promise getFormsInfoByModule begin"); + + var bundleName = parameterValue(); + console.log("FMS_fuzzTest_1400_param_01_promise getFormsInfoByModule bundleName typeof:"+ typeof(bundleName)); + + var moduleName = stringTest(); + console.log("FMS_fuzzTest_1400_param_01_promise getFormsInfoByModule moduleName typeof:"+ typeof(moduleName)); + + var retResult; + try{ + retResult = await Promise.all(await formManager.getFormsInfo(bundleName, moduleName)); + console.log("FMS_fuzzTest_1400_param_01_promise async::sucess retResult:" + retResult); + expect(retResult).assertEqual(1); + done(); + } catch (e) { + console.log("FMS_fuzzTest_1400_param_01_promise Exception caught:" + e); + expect(0).assertEqual(0); + } + + console.log("FMS_fuzzTest_1400_param_01_promise getFormsInfoByModule end"); + done(); + setTimeout(function () { + console.info('=====================FMS_fuzzTest_1400_param_01_promise==================end'); + }, TIMEOUT) + }) + + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_1400 + * @tc.desc Check whether the form configuration information query interface of the specified module + * can pass the fuzzy test (by AsyncCallback) + */ + it('FMS_fuzzTest_1400_param_02_callback', 0, async function (done) { + console.log("FMS_fuzzTest_1400_param_02_callback getFormsInfoByModule begin"); + + var bundleName = stringTest(); + console.log("FMS_fuzzTest_1400_param_02_callback getFormsInfoByModule bundleName typeof:"+ typeof(bundleName)); + + var moduleName = parameterValue(); + console.log("FMS_fuzzTest_1400_param_02_callback getFormsInfoByModule moduleName typeof:"+ typeof(moduleName)); + + try{ + formManager.getFormsInfo( + bundleName, // bundleName string + moduleName, // moduleName string + (err,data) => { + console.log("FMS_fuzzTest_1400_param_02_callback async::callbak return!!!") + console.log("FMS_fuzzTest_1400_param_02_callback async::sucess data:" + data); + console.log("FMS_fuzzTest_1400_param_02_callback async::error err:" + err); + expect(err).assertEqual(1); + done(); + } + ); + } catch (e) { + console.log("FMS_fuzzTest_1400_param_02_callback Exception caught:" + e); + expect(0).assertEqual(0); + } + + console.log("FMS_fuzzTest_1400_param_02_callback getFormsInfoByModule end"); + done(); + setTimeout(function () { + console.info('=====================FMS_fuzzTest_1400_param_02_callback==================end'); + }, TIMEOUT) + }) + + /** + * @tc.name fuzzTest + * @tc.number FMS_fuzzTest_1400 + * @tc.desc Check whether the form configuration information query interface of the specified module + * can pass the fuzzy test (by Promise) + */ + it('FMS_fuzzTest_1400_param_02_promise', 0, async function (done) { + console.log("FMS_fuzzTest_1400_param_02_promise getFormsInfoByModule begin"); + + var bundleName = stringTest(); + console.log("FMS_fuzzTest_1400_param_02_promise getFormsInfoByModule bundleName typeof:"+ typeof(bundleName)); + + var moduleName = parameterValue(); + console.log("FMS_fuzzTest_1400_param_02_promise getFormsInfoByModule moduleName typeof:"+ typeof(moduleName)); + + var retResult; + try{ + retResult = await Promise.all(await formManager.getFormsInfo(bundleName, moduleName)); + console.log("FMS_fuzzTest_1400_param_02_promise async::sucess retResult:" + retResult); + expect(retResult).assertEqual(1); + done(); + } catch (e) { + console.log("FMS_fuzzTest_1400_param_02_promise Exception caught:" + e); + expect(0).assertEqual(0); + } + + console.log("FMS_fuzzTest_1400_param_02_promise getFormsInfoByModule end"); + done(); + setTimeout(function () { + console.info('=====================FMS_fuzzTest_1400_param_02_promise==================end'); + }, TIMEOUT) + }) + +}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/entry/src/main/js/test/List.test.js b/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..ae0ba3f5175a63778a30fa9d3f6076cfe55bd8bf --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/entry/src/main/js/test/List.test.js @@ -0,0 +1,16 @@ +/* + * 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 diff --git a/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/entry/src/main/js/test/getParam.js b/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/entry/src/main/js/test/getParam.js new file mode 100644 index 0000000000000000000000000000000000000000..2dfc85386f59523826e4c7cdaf800e2607141c10 --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/entry/src/main/js/test/getParam.js @@ -0,0 +1,202 @@ +/* + * 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 diff --git a/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f34a4a596cd58f236fd1b7bafc9c924af5bd82f0 --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,21 @@ +{ + "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 diff --git a/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/entry/src/main/resources/base/media/icon.png b/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/entry/src/main/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/signature/openharmony_sx.p7b b/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/aafwk/aafwk_standard/formmanager/formsystemtesthost/FormFuzzTest/signature/openharmony_sx.p7b differ diff --git a/aafwk/aafwk_standard/formmanager/formsystemtesthost/getallformsinfo/BUILD.gn b/aafwk/aafwk_standard/formmanager/formsystemtesthost/getallformsinfo/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..ac4cced06c7b5f7df9c62f464b3af330e24285d7 --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtesthost/getallformsinfo/BUILD.gn @@ -0,0 +1,31 @@ +# 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" +} diff --git a/aafwk/aafwk_standard/formmanager/formsystemtesthost/getallformsinfo/Test.json b/aafwk/aafwk_standard/formmanager/formsystemtesthost/getallformsinfo/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..2f2278f6fa499ab3c66cddb7e7b54fb28e0a20e0 --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtesthost/getallformsinfo/Test.json @@ -0,0 +1,38 @@ +{ + "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" + ] + } + ] +} diff --git a/aafwk/aafwk_standard/formmanager/formsystemtesthost/getallformsinfo/entry/src/main/config.json b/aafwk/aafwk_standard/formmanager/formsystemtesthost/getallformsinfo/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..0ea4476b31fe7e5a4f8f85edfc0a50194559fbe8 --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtesthost/getallformsinfo/entry/src/main/config.json @@ -0,0 +1,90 @@ +{ + "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 diff --git a/aafwk/aafwk_standard/formmanager/formsystemtesthost/getallformsinfo/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/formmanager/formsystemtesthost/getallformsinfo/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..e423f4bce4698ec1d7dc86c3eea3990a5e7b1085 --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtesthost/getallformsinfo/entry/src/main/js/default/app.js @@ -0,0 +1,23 @@ +/* + * 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'); + } +}; diff --git a/aafwk/aafwk_standard/formmanager/formsystemtesthost/getallformsinfo/entry/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/formmanager/formsystemtesthost/getallformsinfo/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtesthost/getallformsinfo/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/formsystemtesthost/getallformsinfo/entry/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/formmanager/formsystemtesthost/getallformsinfo/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtesthost/getallformsinfo/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/formsystemtesthost/getallformsinfo/entry/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/formmanager/formsystemtesthost/getallformsinfo/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..0a66102a6f5e70198f774f5fbf658e36c25cc235 --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtesthost/getallformsinfo/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,44 @@ +.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; + } +} diff --git a/aafwk/aafwk_standard/formmanager/formsystemtesthost/getallformsinfo/entry/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/formmanager/formsystemtesthost/getallformsinfo/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtesthost/getallformsinfo/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/aafwk/aafwk_standard/formmanager/formsystemtesthost/getallformsinfo/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/formmanager/formsystemtesthost/getallformsinfo/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..e4832498bfe3f34bb29573e181ce1b298fb7f617 --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtesthost/getallformsinfo/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,51 @@ +/* + * 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() { + }, +} diff --git a/aafwk/aafwk_standard/formmanager/formsystemtesthost/getallformsinfo/entry/src/main/js/test/GetAllFormsInfoJsunit.test.js b/aafwk/aafwk_standard/formmanager/formsystemtesthost/getallformsinfo/entry/src/main/js/test/GetAllFormsInfoJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..2cd0e8f068a1abe7c90b8e5a20cb3ba026cbc372 --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtesthost/getallformsinfo/entry/src/main/js/test/GetAllFormsInfoJsunit.test.js @@ -0,0 +1,586 @@ +/* + * 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 getAllFormsInfo async::sucess, data json:" + JSON.stringify(data)); + console.log("FMS_getFormsInfo_0300_callback getAllFormsInfo 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).assertEqual("1,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).assertEqual("1,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 getFormsInfo 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 getFormsInfo 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 getFormsInfo 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).assertEqual("1,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).assertEqual("1,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 getFormsInfo 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 getFormsInfo 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 getFormsInfo 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 getFormsInfo 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 getFormsInfo 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).assertEqual("1,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_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).assertEqual("1,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) + }) + +}) diff --git a/aafwk/aafwk_standard/formmanager/formsystemtesthost/getallformsinfo/entry/src/main/js/test/List.test.js b/aafwk/aafwk_standard/formmanager/formsystemtesthost/getallformsinfo/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..439e7f920efce3a5ad2d365d85045cdc0ac8cc02 --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtesthost/getallformsinfo/entry/src/main/js/test/List.test.js @@ -0,0 +1,16 @@ +/* + * 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 diff --git a/aafwk/aafwk_standard/formmanager/formsystemtesthost/getallformsinfo/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/formmanager/formsystemtesthost/getallformsinfo/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..bffd4486bdcce866e73a3222b4f350f7277ab404 --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtesthost/getallformsinfo/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "GetAllFormsInfo" + }, + { + "name": "mainability_description", + "value": "JS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/formsystemtesthost/getallformsinfo/entry/src/main/resources/base/media/icon.png b/aafwk/aafwk_standard/formmanager/formsystemtesthost/getallformsinfo/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/formmanager/formsystemtesthost/getallformsinfo/entry/src/main/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/formmanager/formsystemtesthost/getallformsinfo/signature/openharmony_sx.p7b b/aafwk/aafwk_standard/formmanager/formsystemtesthost/getallformsinfo/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/aafwk/aafwk_standard/formmanager/formsystemtesthost/getallformsinfo/signature/openharmony_sx.p7b differ diff --git a/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestservicea/BUILD.gn b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestservicea/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..5ec2491836fdb9e0221327b719787114ca2bc9f8 --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestservicea/BUILD.gn @@ -0,0 +1,31 @@ +# 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" +} diff --git a/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestservicea/Test.json b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestservicea/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..e70d35c9a1cb3d73cfcf46a599fa869a4ae4e9bd --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestservicea/Test.json @@ -0,0 +1,25 @@ +{ + "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" + ] + + } + ] +} diff --git a/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestservicea/formmodule001/src/main/config.json b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestservicea/formmodule001/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..cc11f8ec9a0cee472de6013205077e1d21b66e78 --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestservicea/formmodule001/src/main/config.json @@ -0,0 +1,107 @@ +{ + "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 diff --git a/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestservicea/formmodule001/src/main/js/default/app.js b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestservicea/formmodule001/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..c19a668a227011507d4cde2906f266da7feca94b --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestservicea/formmodule001/src/main/js/default/app.js @@ -0,0 +1,163 @@ +/* + * 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! ") + } + ); + } +}; diff --git a/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestservicea/formmodule001/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestservicea/formmodule001/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestservicea/formmodule001/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestservicea/formmodule001/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestservicea/formmodule001/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestservicea/formmodule001/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestservicea/formmodule001/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestservicea/formmodule001/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..2b1965821483f4f8c8b97c86ef07fe87ea767d01 --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestservicea/formmodule001/src/main/js/default/pages/index/index.css @@ -0,0 +1,44 @@ +.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; + } +} diff --git a/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestservicea/formmodule001/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestservicea/formmodule001/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestservicea/formmodule001/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestservicea/formmodule001/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestservicea/formmodule001/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..1ced937cf25654b5e91be9753e6b60f21d82569c --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestservicea/formmodule001/src/main/js/default/pages/index/index.js @@ -0,0 +1,23 @@ +/* + * 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'); + } +} diff --git a/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestservicea/formmodule001/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestservicea/formmodule001/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..9afbd847568e1d6c92a318ef611ce8451b7eb309 --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestservicea/formmodule001/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "A_fms" + }, + { + "name": "mainability_description", + "value": "JS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestservicea/formmodule001/src/main/resources/base/media/icon.png b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestservicea/formmodule001/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestservicea/formmodule001/src/main/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestservicea/signature/openharmony_sx.p7b b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestservicea/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestservicea/signature/openharmony_sx.p7b differ diff --git a/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/BUILD.gn b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..1a6355d29049f73a4ee249d51e857b797571c6ee --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/BUILD.gn @@ -0,0 +1,31 @@ +# 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" +} diff --git a/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/Test.json b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4300a64be9af93e37a31f6b5c6fc734e8f1b4563 --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests" +} diff --git a/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/entry/src/main/config.json b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..4ed8bc30f46a482035d7bb1eca9bde507e582878 --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/entry/src/main/config.json @@ -0,0 +1,85 @@ +{ + "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 diff --git a/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..1d80d20f0ce55b7b302c9d7a3d84abef3d74a428 --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/entry/src/main/js/default/app.js @@ -0,0 +1,172 @@ +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 diff --git a/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/entry/src/main/js/default/common/images/Wallpaper.png b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/entry/src/main/js/default/common/images/Wallpaper.png new file mode 100644 index 0000000000000000000000000000000000000000..60d4841a80eb20c63de74306cb7f8350d6a85c48 Binary files /dev/null and b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/entry/src/main/js/default/common/images/Wallpaper.png differ diff --git a/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/entry/src/main/js/default/common/images/bg-tv.jpg b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/entry/src/main/js/default/common/images/bg-tv.jpg new file mode 100644 index 0000000000000000000000000000000000000000..86fc07358eea5c1474bc833fca07c6d4d8698a89 Binary files /dev/null and b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/entry/src/main/js/default/common/images/bg-tv.jpg differ diff --git a/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/entry/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/entry/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/entry/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..0a66102a6f5e70198f774f5fbf658e36c25cc235 --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,44 @@ +.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; + } +} diff --git a/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/entry/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..8a7eec535cfd04ee1c54e23dc2d1074f889d2763 --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,8 @@ +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + } +} diff --git a/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/entry/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..4644abd1c654b4cb8cd230670fbb8e36fbff7033 --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "formSystemTestServiceB" + }, + { + "name": "mainability_description", + "value": "JS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/entry/src/main/js/resources/base/media/icon.png b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/entry/src/main/js/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/entry/src/main/js/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/entry/src/main/package.json b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/entry/src/main/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/entry/src/main/package.json @@ -0,0 +1 @@ +{} diff --git a/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/signature/openharmony_sx.p7b b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/aafwk/aafwk_standard/formmanager/formsystemtestservice/formsystemtestserviceb/signature/openharmony_sx.p7b differ