diff --git a/sensors/BUILD.gn b/sensors/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..b9ac3de4b76b5ef1e93c0012611753b7a65ab97f --- /dev/null +++ b/sensors/BUILD.gn @@ -0,0 +1,21 @@ +# 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("//build/ohos_var.gni") + +group("sensor") { + testonly = true + if (is_standard_system) { + deps = [ "sensor_standard:sensor_js_test" ] + } +} diff --git a/sensors/sensor_standard/BUILD.gn b/sensors/sensor_standard/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..564786fe4ef069edb7721f27842ad8c58296e87e --- /dev/null +++ b/sensors/sensor_standard/BUILD.gn @@ -0,0 +1,30 @@ +# 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("sensor_js_test") { + hap_profile = "./src/main/config.json" + deps = [ + ":sensor_js_assets", + ":sensor_js_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "SensorJSApiTest" +} +ohos_js_assets("sensor_js_assets") { + source_dir = "./src/main/js/default" +} +ohos_resources("sensor_js_resources") { + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" +} diff --git a/sensors/sensor_standard/Test.json b/sensors/sensor_standard/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..6202ee84c3563e09b3decdf8b052296b9293d503 --- /dev/null +++ b/sensors/sensor_standard/Test.json @@ -0,0 +1,18 @@ +{ + "description": "Configuration for sensor js api Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "160000", + "package": "ohos.acts.sensors.sensor.function", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "SensorJSApiTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/sensors/sensor_standard/signature/openharmony_sx.p7b b/sensors/sensor_standard/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/sensors/sensor_standard/signature/openharmony_sx.p7b differ diff --git a/sensors/sensor_standard/src/main/config.json b/sensors/sensor_standard/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..764f279caee28996e84cbbece7d224b097c2e836 --- /dev/null +++ b/sensors/sensor_standard/src/main/config.json @@ -0,0 +1,60 @@ +{ + "app": { + "bundleName": "ohos.acts.sensors.sensor.function", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5 + } + }, + "deviceConfig": {}, + "module": { + "package": "ohos.acts.sensors.sensor.function", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "ohos.acts.sensors.sensor.function.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} diff --git a/sensors/sensor_standard/src/main/js/default/app.js b/sensors/sensor_standard/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..e423f4bce4698ec1d7dc86c3eea3990a5e7b1085 --- /dev/null +++ b/sensors/sensor_standard/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/sensors/sensor_standard/src/main/js/default/i18n/en-US.json b/sensors/sensor_standard/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/sensors/sensor_standard/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/sensors/sensor_standard/src/main/js/default/i18n/zh-CN.json b/sensors/sensor_standard/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/sensors/sensor_standard/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/sensors/sensor_standard/src/main/js/default/pages/index/index.css b/sensors/sensor_standard/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/sensors/sensor_standard/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/sensors/sensor_standard/src/main/js/default/pages/index/index.hml b/sensors/sensor_standard/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/sensors/sensor_standard/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +