diff --git a/demo/BUILD.gn b/demo/BUILD.gn old mode 100644 new mode 100755 diff --git a/demo/hjsunit_sample/BUILD.gn b/demo/hjsunit_sample/BUILD.gn old mode 100644 new mode 100755 index bb33162e7aa049ed07d0868135b095526ff7287a..e2ed3b544bba1eaa88033c3e099ee4aa3231565e --- a/demo/hjsunit_sample/BUILD.gn +++ b/demo/hjsunit_sample/BUILD.gn @@ -10,9 +10,27 @@ # 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") +import("//test/xts/tools/build/suite.gni") ohos_js_hap_suite("hjs_demo_test") { - test_hap_name = "Hjsdemotest" - hap_source_path = "hap/entry-debug-signed.hap" + hap_profile = "./src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] +# shared_libraries = [ + # "//third_party/giflib:libgif", +# "//third_party/libpng:libpng", +# ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "Hjsdemotest" +# part_name = "prebuilt_hap" +# subsystem_name = "xts" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./src/main/js/default" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" } diff --git a/demo/hjsunit_sample/Test.json b/demo/hjsunit_sample/Test.json old mode 100644 new mode 100755 diff --git a/demo/hjsunit_sample/entry/package.json b/demo/hjsunit_sample/entry/package.json deleted file mode 100644 index 69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f..0000000000000000000000000000000000000000 --- a/demo/hjsunit_sample/entry/package.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/demo/hjsunit_sample/hap/entry-debug-signed.hap b/demo/hjsunit_sample/hap/entry-debug-signed.hap deleted file mode 100644 index 76b7653122e4d2e26c18bffa99b0a360c8aeda4d..0000000000000000000000000000000000000000 Binary files a/demo/hjsunit_sample/hap/entry-debug-signed.hap and /dev/null differ diff --git a/demo/hjsunit_sample/signature/openharmony_sx.p7b b/demo/hjsunit_sample/signature/openharmony_sx.p7b new file mode 100755 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/demo/hjsunit_sample/signature/openharmony_sx.p7b differ diff --git a/demo/hjsunit_sample/entry/src/main/config.json b/demo/hjsunit_sample/src/main/config.json old mode 100644 new mode 100755 similarity index 98% rename from demo/hjsunit_sample/entry/src/main/config.json rename to demo/hjsunit_sample/src/main/config.json index 69e91f6f3c092c58389896b409b26353ccf442f1..9889c145cf45093c6b938d34bb050c555653f09e --- a/demo/hjsunit_sample/entry/src/main/config.json +++ b/demo/hjsunit_sample/src/main/config.json @@ -8,7 +8,7 @@ }, "apiVersion": { "compatible": 4, - "target": 4 + "target": 5 } }, "deviceConfig": {}, diff --git a/demo/hjsunit_sample/entry/src/main/js/default/app.js b/demo/hjsunit_sample/src/main/js/default/app.js old mode 100644 new mode 100755 similarity index 100% rename from demo/hjsunit_sample/entry/src/main/js/default/app.js rename to demo/hjsunit_sample/src/main/js/default/app.js diff --git a/demo/hjsunit_sample/entry/src/main/js/default/i18n/en-US.json b/demo/hjsunit_sample/src/main/js/default/i18n/en-US.json old mode 100644 new mode 100755 similarity index 100% rename from demo/hjsunit_sample/entry/src/main/js/default/i18n/en-US.json rename to demo/hjsunit_sample/src/main/js/default/i18n/en-US.json diff --git a/demo/hjsunit_sample/entry/src/main/js/default/i18n/zh-CN.json b/demo/hjsunit_sample/src/main/js/default/i18n/zh-CN.json old mode 100644 new mode 100755 similarity index 100% rename from demo/hjsunit_sample/entry/src/main/js/default/i18n/zh-CN.json rename to demo/hjsunit_sample/src/main/js/default/i18n/zh-CN.json diff --git a/demo/hjsunit_sample/src/main/js/default/pages/index/index.css b/demo/hjsunit_sample/src/main/js/default/pages/index/index.css new file mode 100755 index 0000000000000000000000000000000000000000..caf729946975b79e55ab9e56e55bf860337b3f50 --- /dev/null +++ b/demo/hjsunit_sample/src/main/js/default/pages/index/index.css @@ -0,0 +1,38 @@ +/* + * 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. + */ + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} diff --git a/demo/hjsunit_sample/src/main/js/default/pages/index/index.hml b/demo/hjsunit_sample/src/main/js/default/pages/index/index.hml new file mode 100755 index 0000000000000000000000000000000000000000..61ea59d936e5a2971f1ea3d179c44a7f3f596c54 --- /dev/null +++ b/demo/hjsunit_sample/src/main/js/default/pages/index/index.hml @@ -0,0 +1,21 @@ + + +
+ + {{ $t('strings.hello') }} {{title}} + + +
diff --git a/demo/hjsunit_sample/entry/src/main/js/default/pages/index/index.js b/demo/hjsunit_sample/src/main/js/default/pages/index/index.js old mode 100644 new mode 100755 similarity index 64% rename from demo/hjsunit_sample/entry/src/main/js/default/pages/index/index.js rename to demo/hjsunit_sample/src/main/js/default/pages/index/index.js index bd751ec7dbbccdac420ee21d0b1b314c836db673..37d3d82171002a3214286dc10315e4baef40f4e6 --- a/demo/hjsunit_sample/entry/src/main/js/default/pages/index/index.js +++ b/demo/hjsunit_sample/src/main/js/default/pages/index/index.js @@ -12,11 +12,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import file from '@system.file' + import app from '@system.app' -//import {Core, ExpectExtend, ReportExtend, InstrumentLog} from 'deccjsunit/index' -import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' +import {Core, ExpectExtend} from 'deccjsunit/index' export default { data: { @@ -31,22 +30,14 @@ export default { const expectExtend = new ExpectExtend({ 'id': 'extend' }) - const reportExtend = new ReportExtend(file) -// const instrumentLog = new InstrumentLog({ -// 'id': 'report' -// }) + core.addService('expect', expectExtend) - core.addService('report', reportExtend) -// core.addService('report', instrumentLog) core.init() -// core.subscribeEvent('spec', instrumentLog) -// core.subscribeEvent('suite', instrumentLog) -// core.subscribeEvent('task', instrumentLog) const configService = core.getDefaultService('config') configService.setConfig(this) - require('../../../test/List.test') + require('../../test/List.test') core.execute() }, onReady() { diff --git a/demo/hjsunit_sample/entry/src/main/js/test/ExampleJsunit.test.js b/demo/hjsunit_sample/src/main/js/default/test/ExampleJsunit.test.js old mode 100644 new mode 100755 similarity index 78% rename from demo/hjsunit_sample/entry/src/main/js/test/ExampleJsunit.test.js rename to demo/hjsunit_sample/src/main/js/default/test/ExampleJsunit.test.js index 4fdf2a890581dfe125e8e196149f44118ae94134..649e6afc937e00431530ba5f0782e7d2e4cf95c7 --- a/demo/hjsunit_sample/entry/src/main/js/test/ExampleJsunit.test.js +++ b/demo/hjsunit_sample/src/main/js/default/test/ExampleJsunit.test.js @@ -13,7 +13,6 @@ * limitations under the License. */ import app from '@system.app' -import Context from '@ohos.napi_context' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' @@ -40,15 +39,5 @@ describe('appInfoTest', function () { expect(info.versionName).assertEqual('1.0') expect(info.versionCode).assertEqual('5') }) - it('get_process_info_test_001', 0, async function (done) { - console.log("111") - expect(1).assertLarger(0) - Context.getProcessInfo().then(info => { - console.log("222"); - console.log("process_info: " + JSON.stringify(info)); - expect(info.processName.length).assertLarger(0); - expect(info.pid).assertLarger(0); - }); - done() - }) + }) diff --git a/demo/hjsunit_sample/entry/src/main/js/test/List.test.js b/demo/hjsunit_sample/src/main/js/default/test/List.test.js old mode 100644 new mode 100755 similarity index 100% rename from demo/hjsunit_sample/entry/src/main/js/test/List.test.js rename to demo/hjsunit_sample/src/main/js/default/test/List.test.js diff --git a/demo/hjsunit_sample/src/main/resources/base/element/string.json b/demo/hjsunit_sample/src/main/resources/base/element/string.json new file mode 100755 index 0000000000000000000000000000000000000000..f94ce7e64e455e1ebf22a4b2792c5b52c791d037 --- /dev/null +++ b/demo/hjsunit_sample/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "JsHelloWorld" + }, + { + "name": "mainability_description", + "value": "hap sample empty page" + } + ] +} \ No newline at end of file diff --git a/demo/hjsunit_sample/src/main/resources/base/media/icon.png b/demo/hjsunit_sample/src/main/resources/base/media/icon.png new file mode 100755 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/demo/hjsunit_sample/src/main/resources/base/media/icon.png differ