From dc469947ad343f3b9b136f31f498abf4585acf98 Mon Sep 17 00:00:00 2001 From: ding_chengjie Date: Thu, 16 Mar 2023 11:59:54 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=82=E9=85=8DDevEco=20Studio=203.1=20Beta1?= =?UTF-8?q?=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ding_chengjie --- CHANGELOG.md | 5 +++ OAT.xml | 4 +- README.md | 3 +- hvigorfile.js => entry/hvigorfile.ts | 2 +- entry/package.json | 28 ++++++------- .../main/ets/Application/MyAbilityStage.ts | 27 ------------ .../EntryAbility.ts} | 29 ++++++------- entry/src/main/module.json5 | 23 +++++++---- .../main/resources/base/element/color.json | 2 +- .../main/resources/base/element/string.json | 10 ++--- .../resources/base/profile/main_pages.json | 2 +- .../main/resources/en_US/element/string.json | 16 ++++++++ .../main/resources/zh_CN/element/string.json | 16 ++++++++ .../ets/Application/TestAbilityStage.ts | 27 ------------ .../{TestAbility.ts => TestAbility.ets} | 39 ++++++++++-------- .../ohosTest/ets/TestAbility/pages/index.ets | 4 +- .../ets/TestRunner/OpenHarmonyTestRunner.ts | 41 ++++++------------- entry/src/ohosTest/ets/test/Ability.test.ets | 38 +++++++++++++---- entry/src/ohosTest/module.json5 | 7 ++-- .../resources/base/element/color.json | 2 +- .../resources/base/element/string.json | 2 +- .../resources/base/profile/test_pages.json | 2 +- entry/hvigorfile.js => hvigorfile.ts | 2 +- package.json | 32 +++++++-------- qrcodegen/.gitignore | 3 +- qrcodegen/build-profile.json5 | 7 +++- qrcodegen/{hvigorfile.js => hvigorfile.ts} | 3 +- qrcodegen/package.json | 41 +++++++++++-------- .../main/resources/en_US/element/string.json | 8 ++++ .../main/resources/zh_CN/element/string.json | 8 ++++ 30 files changed, 230 insertions(+), 203 deletions(-) rename hvigorfile.js => entry/hvigorfile.ts (63%) delete mode 100644 entry/src/main/ets/Application/MyAbilityStage.ts rename entry/src/main/ets/{MainAbility/MainAbility.ts => entryability/EntryAbility.ts} (61%) create mode 100644 entry/src/main/resources/en_US/element/string.json create mode 100644 entry/src/main/resources/zh_CN/element/string.json delete mode 100644 entry/src/ohosTest/ets/Application/TestAbilityStage.ts rename entry/src/ohosTest/ets/TestAbility/{TestAbility.ts => TestAbility.ets} (53%) rename entry/hvigorfile.js => hvigorfile.ts (63%) rename qrcodegen/{hvigorfile.js => hvigorfile.ts} (62%) create mode 100644 qrcodegen/src/main/resources/en_US/element/string.json create mode 100644 qrcodegen/src/main/resources/zh_CN/element/string.json diff --git a/CHANGELOG.md b/CHANGELOG.md index bb6dc62..19a2f84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 1.0.1 + +- 适配DevEco Studio 3.1Beta1及以上版本。 +- 适配OpenHarmony SDK API version 9及以上版本。 + ## 1.0.0 1. 二维码生成器 diff --git a/OAT.xml b/OAT.xml index 4e9cc2d..af3639e 100644 --- a/OAT.xml +++ b/OAT.xml @@ -3,9 +3,9 @@ - + - + diff --git a/README.md b/README.md index 47e596b..3c4ee0d 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,8 @@ qrcode.drawCanvas(8, 1, this.Context) 4. 解释段的数据位:`qrcodegen.QrSegment.Mode` ## 兼容性 -支持 OpenHarmony API version 9版本。 +- [DevEco Studio版本](https://developer.harmonyos.com/cn/develop/deveco-studio#download):DevEco Studio 3.1Beta1及以上版本。 +- OpenHarmony SDK版本:API version 9及以上版本。 ## 目录结构 ```` diff --git a/hvigorfile.js b/entry/hvigorfile.ts similarity index 63% rename from hvigorfile.js rename to entry/hvigorfile.ts index 5f2735e..80e4ec5 100644 --- a/hvigorfile.js +++ b/entry/hvigorfile.ts @@ -1,2 +1,2 @@ // Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. -module.exports = require('@ohos/hvigor-ohos-plugin').appTasks \ No newline at end of file +export { hapTasks } from '@ohos/hvigor-ohos-plugin'; diff --git a/entry/package.json b/entry/package.json index 4ff23ea..40ebb90 100644 --- a/entry/package.json +++ b/entry/package.json @@ -1,16 +1,16 @@ { - "license": "MIT", - "devDependencies": {}, - "name": "entry", - "ohos": { - "org": "huawei", - "directoryLevel": "module", - "buildTool": "hvigor" - }, - "description": "example description", - "repository": {}, - "version": "1.0.0", - "dependencies": { - "@ohos/qr-code-generator": "file:../qrcodegen" - } + "license": "MIT", + "devDependencies": {}, + "name": "entry", + "ohos": { + "org": "huawei", + "directoryLevel": "module", + "buildTool": "hvigor" + }, + "description": "example description", + "repository": {}, + "version": "1.0.1", + "dependencies": { + "@ohos/qr-code-generator": "file:../qrcodegen" + } } diff --git a/entry/src/main/ets/Application/MyAbilityStage.ts b/entry/src/main/ets/Application/MyAbilityStage.ts deleted file mode 100644 index 306caf5..0000000 --- a/entry/src/main/ets/Application/MyAbilityStage.ts +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - The Software is provided "as is", without warranty of any kind, express or - * implied, including but not limited to the warranties of merchantability, - * fitness for a particular purpose and noninfringement. In no event shall the - * authors or copyright holders be liable for any claim, damages or other - * liability, whether in an action of contract, tort or otherwise, arising from, - * out of or in connection with the Software or the use or other dealings in the - * Software. - */ - -import AbilityStage from "@ohos.application.AbilityStage" - -export default class MyAbilityStage extends AbilityStage { - onCreate() { - console.log("[Demo] MyAbilityStage onCreate") - } -} \ No newline at end of file diff --git a/entry/src/main/ets/MainAbility/MainAbility.ts b/entry/src/main/ets/entryability/EntryAbility.ts similarity index 61% rename from entry/src/main/ets/MainAbility/MainAbility.ts rename to entry/src/main/ets/entryability/EntryAbility.ts index d0a6180..f606afb 100644 --- a/entry/src/main/ets/MainAbility/MainAbility.ts +++ b/entry/src/main/ets/entryability/EntryAbility.ts @@ -17,44 +17,45 @@ * out of or in connection with the Software or the use or other dealings in the * Software. */ + +import UIAbility from '@ohos.app.ability.UIAbility'; +import hilog from '@ohos.hilog'; +import window from '@ohos.window'; -import Ability from '@ohos.application.Ability' - -export default class MainAbility extends Ability { +export default class EntryAbility extends UIAbility { onCreate(want, launchParam) { - console.log("[Demo] MainAbility onCreate") - globalThis.abilityWant = want; + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); } onDestroy() { - console.log("[Demo] MainAbility onDestroy") + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); } - onWindowStageCreate(windowStage) { + onWindowStageCreate(windowStage: window.WindowStage) { // Main window is created, set main page for this ability - console.log("[Demo] MainAbility onWindowStageCreate") + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); - windowStage.loadContent("pages/index", (err, data) => { + windowStage.loadContent('pages/Index', (err, data) => { if (err.code) { - console.error('Failed to load the content. Cause:' + JSON.stringify(err)); + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); return; } - console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data)) + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); }); } onWindowStageDestroy() { // Main window is destroyed, release UI related resources - console.log("[Demo] MainAbility onWindowStageDestroy") + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); } onForeground() { // Ability has brought to foreground - console.log("[Demo] MainAbility onForeground") + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); } onBackground() { // Ability has back to background - console.log("[Demo] MainAbility onBackground") + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); } } diff --git a/entry/src/main/module.json5 b/entry/src/main/module.json5 index e73e5b8..684b172 100644 --- a/entry/src/main/module.json5 +++ b/entry/src/main/module.json5 @@ -2,25 +2,30 @@ "module": { "name": "entry", "type": "entry", - "srcEntrance": "./ets/Application/MyAbilityStage.ts", - "description": "$string:entry_desc", - "mainElement": "MainAbility", + "description": "$string:module_desc", + "mainElement": "EntryAbility", "deviceTypes": [ "default", "tablet" ], + "metadata": [ + { + "name": "ArkTSPartialUpdate", + "value": "true" + } + ], "deliveryWithInstall": true, "installationFree": false, "pages": "$profile:main_pages", "abilities": [ { - "name": "MainAbility", - "srcEntrance": "./ets/MainAbility/MainAbility.ts", - "description": "$string:MainAbility_desc", + "name": "EntryAbility", + "srcEntrance": "./ets/entryability/EntryAbility.ts", + "description": "$string:EntryAbility_desc", "icon": "$media:icon", - "label": "$string:MainAbility_label", + "label": "$string:EntryAbility_label", "startWindowIcon": "$media:icon", - "startWindowBackground": "$color:white", + "startWindowBackground": "$color:start_window_background", "visible": true, "skills": [ { @@ -35,4 +40,4 @@ } ] } -} +} \ No newline at end of file diff --git a/entry/src/main/resources/base/element/color.json b/entry/src/main/resources/base/element/color.json index 1bbc9aa..3c71296 100644 --- a/entry/src/main/resources/base/element/color.json +++ b/entry/src/main/resources/base/element/color.json @@ -1,7 +1,7 @@ { "color": [ { - "name": "white", + "name": "start_window_background", "value": "#FFFFFF" } ] diff --git a/entry/src/main/resources/base/element/string.json b/entry/src/main/resources/base/element/string.json index 490210a..de31c30 100644 --- a/entry/src/main/resources/base/element/string.json +++ b/entry/src/main/resources/base/element/string.json @@ -1,16 +1,16 @@ { "string": [ { - "name": "entry_desc", - "value": "description" + "name": "module_desc", + "value": "module description" }, { - "name": "MainAbility_desc", + "name": "EntryAbility_desc", "value": "description" }, { - "name": "MainAbility_label", - "value": "label" + "name": "EntryAbility_label", + "value": "qrcodegenerator" } ] } \ No newline at end of file diff --git a/entry/src/main/resources/base/profile/main_pages.json b/entry/src/main/resources/base/profile/main_pages.json index feec276..1898d94 100644 --- a/entry/src/main/resources/base/profile/main_pages.json +++ b/entry/src/main/resources/base/profile/main_pages.json @@ -1,5 +1,5 @@ { "src": [ - "pages/index" + "pages/Index" ] } diff --git a/entry/src/main/resources/en_US/element/string.json b/entry/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000..de31c30 --- /dev/null +++ b/entry/src/main/resources/en_US/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "qrcodegenerator" + } + ] +} \ No newline at end of file diff --git a/entry/src/main/resources/zh_CN/element/string.json b/entry/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000..a3aadc0 --- /dev/null +++ b/entry/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "模块描述" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "qrcodegenerator" + } + ] +} \ No newline at end of file diff --git a/entry/src/ohosTest/ets/Application/TestAbilityStage.ts b/entry/src/ohosTest/ets/Application/TestAbilityStage.ts deleted file mode 100644 index a2b4ac3..0000000 --- a/entry/src/ohosTest/ets/Application/TestAbilityStage.ts +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - The Software is provided "as is", without warranty of any kind, express or - * implied, including but not limited to the warranties of merchantability, - * fitness for a particular purpose and noninfringement. In no event shall the - * authors or copyright holders be liable for any claim, damages or other - * liability, whether in an action of contract, tort or otherwise, arising from, - * out of or in connection with the Software or the use or other dealings in the - * Software. - */ - -import AbilityStage from "@ohos.application.AbilityStage" - -export default class TestAbilityStage extends AbilityStage { - onCreate() { - console.log("[Demo] TestAbilityStage onCreate") - } -} \ No newline at end of file diff --git a/entry/src/ohosTest/ets/TestAbility/TestAbility.ts b/entry/src/ohosTest/ets/TestAbility/TestAbility.ets similarity index 53% rename from entry/src/ohosTest/ets/TestAbility/TestAbility.ts rename to entry/src/ohosTest/ets/TestAbility/TestAbility.ets index 8eb24f5..5806196 100644 --- a/entry/src/ohosTest/ets/TestAbility/TestAbility.ts +++ b/entry/src/ohosTest/ets/TestAbility/TestAbility.ets @@ -18,48 +18,51 @@ * Software. */ -import Ability from '@ohos.application.Ability' -import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' -import { Hypium } from '@ohos/hypium' -import testsuite from '../test/List.test' +import UIAbility from '@ohos.app.ability.UIAbility'; +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; +import hilog from '@ohos.hilog'; +import { Hypium } from '@ohos/hypium'; +import testsuite from '../test/List.test'; +import window from '@ohos.window'; -export default class TestAbility extends Ability { +export default class TestAbility extends UIAbility { onCreate(want, launchParam) { - console.log('TestAbility onCreate') + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); + hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); + hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); var abilityDelegator: any abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() var abilityDelegatorArguments: any abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - console.info('start run testcase!!!') + hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) } onDestroy() { - console.log('TestAbility onDestroy') + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); } - onWindowStageCreate(windowStage) { - console.log('TestAbility onWindowStageCreate') - windowStage.loadContent("TestAbility/pages/index", (err, data) => { + onWindowStageCreate(windowStage: window.WindowStage) { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); + windowStage.loadContent('testability/pages/Index', (err, data) => { if (err.code) { - console.error('Failed to load the content. Cause:' + JSON.stringify(err)); + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); return; } - console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data)) + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', + JSON.stringify(data) ?? ''); }); - - globalThis.abilityContext = this.context; } onWindowStageDestroy() { - console.log('TestAbility onWindowStageDestroy') + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); } onForeground() { - console.log('TestAbility onForeground') + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); } onBackground() { - console.log('TestAbility onBackground') + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); } } \ No newline at end of file diff --git a/entry/src/ohosTest/ets/TestAbility/pages/index.ets b/entry/src/ohosTest/ets/TestAbility/pages/index.ets index 408d925..60e1d74 100644 --- a/entry/src/ohosTest/ets/TestAbility/pages/index.ets +++ b/entry/src/ohosTest/ets/TestAbility/pages/index.ets @@ -18,13 +18,13 @@ * Software. */ -import router from '@ohos.router'; +import hilog from '@ohos.hilog'; @Entry @Component struct Index { aboutToAppear() { - console.info('TestAbility index aboutToAppear') + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); } @State message: string = 'Hello World' build() { diff --git a/entry/src/ohosTest/ets/TestRunner/OpenHarmonyTestRunner.ts b/entry/src/ohosTest/ets/TestRunner/OpenHarmonyTestRunner.ts index e73bbe2..72d33fe 100644 --- a/entry/src/ohosTest/ets/TestRunner/OpenHarmonyTestRunner.ts +++ b/entry/src/ohosTest/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -18,33 +18,19 @@ * Software. */ -import TestRunner from '@ohos.application.testRunner' -import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import hilog from '@ohos.hilog'; +import TestRunner from '@ohos.application.testRunner'; +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; var abilityDelegator = undefined var abilityDelegatorArguments = undefined -function translateParamsToString(parameters) { - const keySet = new Set([ - '-s class', '-s notClass', '-s suite', '-s it', - '-s level', '-s testType', '-s size', '-s timeout', - '-s dryRun' - ]) - let targetParams = ''; - for (const key in parameters) { - if (keySet.has(key)) { - targetParams = `${targetParams} ${key} ${parameters[key]}` - } - } - return targetParams.trim() -} - async function onAbilityCreateCallback() { - console.log("onAbilityCreateCallback"); + hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); } async function addAbilityMonitorCallback(err: any) { - console.info("addAbilityMonitorCallback : " + JSON.stringify(err)) + hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); } export default class OpenHarmonyTestRunner implements TestRunner { @@ -52,11 +38,11 @@ export default class OpenHarmonyTestRunner implements TestRunner { } onPrepare() { - console.info("OpenHarmonyTestRunner OnPrepare ") + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); } async onRun() { - console.log('OpenHarmonyTestRunner onRun run') + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' @@ -66,19 +52,18 @@ export default class OpenHarmonyTestRunner implements TestRunner { }; abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName - cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) - var debug = abilityDelegatorArguments.parameters["-D"] + var debug = abilityDelegatorArguments.parameters['-D'] if (debug == 'true') { cmd += ' -D' } - console.info('cmd : '+cmd) + hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); abilityDelegator.executeShellCommand(cmd, (err: any, d: any) => { - console.info('executeShellCommand : err : ' + JSON.stringify(err)); - console.info('executeShellCommand : data : ' + d.stdResult); - console.info('executeShellCommand : data : ' + d.exitCode); + hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); + hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); + hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); }) - console.info('OpenHarmonyTestRunner onRun end') + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); } } \ No newline at end of file diff --git a/entry/src/ohosTest/ets/test/Ability.test.ets b/entry/src/ohosTest/ets/test/Ability.test.ets index 1a948c4..4152da9 100644 --- a/entry/src/ohosTest/ets/test/Ability.test.ets +++ b/entry/src/ohosTest/ets/test/Ability.test.ets @@ -18,16 +18,38 @@ * Software. */ +import hilog from '@ohos.hilog'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' export default function abilityTest() { - describe('ActsAbilityTest', function () { - it('assertContain',0, function () { - console.info("it begin") - let a = 'abc' - let b = 'b' - expect(a).assertContain(b) - expect(a).assertEqual(a) - }) + describe('ActsAbilityTest', function () { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(function () { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. }) + beforeEach(function () { + // Presets an action, which is performed before each unit test case starts. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: preset action function. + }) + afterEach(function () { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }) + afterAll(function () { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }) + it('assertContain',0, function () { + // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. + hilog.info(0x0000, 'testTag', '%{public}s', 'it begin'); + let a = 'abc' + let b = 'b' + // Defines a variety of assertion methods, which are used to declare expected boolean conditions. + expect(a).assertContain(b) + expect(a).assertEqual(a) + }) + }) } \ No newline at end of file diff --git a/entry/src/ohosTest/module.json5 b/entry/src/ohosTest/module.json5 index def8dda..476d153 100644 --- a/entry/src/ohosTest/module.json5 +++ b/entry/src/ohosTest/module.json5 @@ -2,8 +2,7 @@ "module": { "name": "entry_test", "type": "feature", - "srcEntrance": "./ets/Application/TestAbilityStage.ts", - "description": "$string:entry_test_desc", + "description": "$string:module_test_desc", "mainElement": "TestAbility", "deviceTypes": [ "default", @@ -15,13 +14,13 @@ "abilities": [ { "name": "TestAbility", - "srcEntrance": "./ets/TestAbility/TestAbility.ts", + "srcEntrance": "./ets/testability/TestAbility.ets", "description": "$string:TestAbility_desc", "icon": "$media:icon", "label": "$string:TestAbility_label", "visible": true, "startWindowIcon": "$media:icon", - "startWindowBackground": "$color:white", + "startWindowBackground": "$color:start_window_background", "skills": [ { "actions": [ diff --git a/entry/src/ohosTest/resources/base/element/color.json b/entry/src/ohosTest/resources/base/element/color.json index 1bbc9aa..3c71296 100644 --- a/entry/src/ohosTest/resources/base/element/color.json +++ b/entry/src/ohosTest/resources/base/element/color.json @@ -1,7 +1,7 @@ { "color": [ { - "name": "white", + "name": "start_window_background", "value": "#FFFFFF" } ] diff --git a/entry/src/ohosTest/resources/base/element/string.json b/entry/src/ohosTest/resources/base/element/string.json index 36d4230..65d8fa5 100644 --- a/entry/src/ohosTest/resources/base/element/string.json +++ b/entry/src/ohosTest/resources/base/element/string.json @@ -1,7 +1,7 @@ { "string": [ { - "name": "entry_test_desc", + "name": "module_test_desc", "value": "test ability description" }, { diff --git a/entry/src/ohosTest/resources/base/profile/test_pages.json b/entry/src/ohosTest/resources/base/profile/test_pages.json index fcef82b..b7e7343 100644 --- a/entry/src/ohosTest/resources/base/profile/test_pages.json +++ b/entry/src/ohosTest/resources/base/profile/test_pages.json @@ -1,5 +1,5 @@ { "src": [ - "TestAbility/pages/index" + "testability/pages/Index" ] } diff --git a/entry/hvigorfile.js b/hvigorfile.ts similarity index 63% rename from entry/hvigorfile.js rename to hvigorfile.ts index d7720ee..6478186 100644 --- a/entry/hvigorfile.js +++ b/hvigorfile.ts @@ -1,2 +1,2 @@ // Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. -module.exports = require('@ohos/hvigor-ohos-plugin').hapTasks +export { appTasks } from '@ohos/hvigor-ohos-plugin'; \ No newline at end of file diff --git a/package.json b/package.json index 09f4746..6e13681 100644 --- a/package.json +++ b/package.json @@ -1,18 +1,18 @@ { - "license": "MIT", - "devDependencies": {}, - "name": "qrcodegenerator", - "ohos": { - "org": "huawei", - "directoryLevel": "project", - "buildTool": "hvigor" - }, - "description": "example description", - "repository": {}, - "version": "1.0.0", - "dependencies": { - "@ohos/hypium": "1.0.1", - "@ohos/hvigor-ohos-plugin": "1.1.6", - "@ohos/hvigor": "1.1.6" - } + "license": "MIT", + "devDependencies": {}, + "name": "qrcodegenerator", + "ohos": { + "org": "huawei", + "directoryLevel": "project", + "buildTool": "hvigor" + }, + "description": "example description", + "repository": {}, + "version": "1.0.1", + "dependencies": { + "@ohos/hypium": "1.0.5", + "@ohos/hvigor-ohos-plugin": "1.4.0", + "@ohos/hvigor": "1.4.0" + } } diff --git a/qrcodegen/.gitignore b/qrcodegen/.gitignore index 4f9a973..5a6ba80 100644 --- a/qrcodegen/.gitignore +++ b/qrcodegen/.gitignore @@ -1,3 +1,4 @@ /node_modules /.preview -/build \ No newline at end of file +/build +/.cxx \ No newline at end of file diff --git a/qrcodegen/build-profile.json5 b/qrcodegen/build-profile.json5 index 35dff6d..79961f9 100644 --- a/qrcodegen/build-profile.json5 +++ b/qrcodegen/build-profile.json5 @@ -1,5 +1,10 @@ { "apiType": "stageMode", "buildOption": { - } + }, + "targets": [ + { + "name": "default" + } + ] } diff --git a/qrcodegen/hvigorfile.js b/qrcodegen/hvigorfile.ts similarity index 62% rename from qrcodegen/hvigorfile.js rename to qrcodegen/hvigorfile.ts index 42ed4b4..47e6e1f 100644 --- a/qrcodegen/hvigorfile.js +++ b/qrcodegen/hvigorfile.ts @@ -1,3 +1,2 @@ // Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. -module.exports = require('@ohos/hvigor-ohos-plugin').harTasks - +export { harTasks } from '@ohos/hvigor-ohos-plugin'; \ No newline at end of file diff --git a/qrcodegen/package.json b/qrcodegen/package.json index c9494a9..0d117e4 100644 --- a/qrcodegen/package.json +++ b/qrcodegen/package.json @@ -1,19 +1,26 @@ { - "license": "MIT", - "types": "", - "devDependencies": {}, - "keywords": [ - "qrcode", - "OpenHarmony" - ], - "author": "hihope", - "name": "@ohos/qr-code-generator", - "description": "High-quality QR Code generator library", - "ohos": { - "org": "opensource" - }, - "main": "index.ets", - "repository": "https://gitee.com/openharmony-sig/qr-code-generator", - "version": "1.0.0", - "dependencies": {} + "types": "", + "keywords": [ + "qrcode", + "OpenHarmony", + "HarmonyOS" + ], + "author": "hihope", + "description": "High-quality QR Code generator library", + "ohos": { + "org": "opensource" + }, + "main": "index.ets", + "type": "module", + "repository": "https://gitee.com/openharmony-sig/qr-code-generator", + "version": "1.0.1", + "tags": [ + "OpenHarmony", + "qrcode", + "HarmonyOS" + ], + "dependencies": {}, + "license": "MIT", + "devDependencies": {}, + "name": "@ohos/qr-code-generator" } diff --git a/qrcodegen/src/main/resources/en_US/element/string.json b/qrcodegen/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000..1e76de0 --- /dev/null +++ b/qrcodegen/src/main/resources/en_US/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "page_show", + "value": "page from npm package" + } + ] +} diff --git a/qrcodegen/src/main/resources/zh_CN/element/string.json b/qrcodegen/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000..1e76de0 --- /dev/null +++ b/qrcodegen/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "page_show", + "value": "page from npm package" + } + ] +} -- Gitee