!4948 新增Form Kit 相关示例代码的sample,通过FormMenu在应用内添加卡片

Merge pull request !4948 from l-l/master
This commit is contained in:
openharmony_ci 2024-11-20 01:59:07 +00:00 committed by Gitee
commit 36f3a09df5
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
53 changed files with 1638 additions and 0 deletions

View File

@ -103,6 +103,14 @@ Note:If the text contains special characters, please escape them according to th
<filteritem type="filepath" name="network/Bluetooth/entry/src/main/java/ohos/samples/bluetooth/adapter/" desc="Not contains 3rd codelicense file is not required in this subdirectory."/>
</filefilter>
<filefilter name="binaryFileTypePolicyFilter" desc="Filters for binary file policies" >
<filteritem type="filepath" name="code/DocsSample/Form/FormAddMenuDemo/entry/src/main/resources/base/media/startIcon.png" desc="Provided by code/DocsSample/Form/FormAddMenuDemo."/>
<filteritem type="filepath" name="code/DocsSample/Form/FormAddMenuDemo/entry/src/ohosTest/resources/base/media/icon.png" desc="Provided by code/DocsSample/Form/FormAddMenuDemo."/>
<filteritem type="filepath" name="code/DocsSample/Form/FormAddMenuDemo/entry/src/main/resources/base/media/background.png" desc="Provided by code/DocsSample/Form/FormAddMenuDemo."/>
<filteritem type="filepath" name="code/DocsSample/Form/FormAddMenuDemo/screenshots/index.png" desc="Provided by code/DocsSample/Form/FormAddMenuDemo."/>
<filteritem type="filepath" name="code/DocsSample/Form/FormAddMenuDemo/AppScope/resources/base/media/app_icon.png" desc="Provided by code/DocsSample/Form/FormAddMenuDemo."/>
<filteritem type="filepath" name="code/DocsSample/Form/FormAddMenuDemo/entry/src/main/resources/base/media/CardEvent.png" desc="Provided by code/DocsSample/Form/FormAddMenuDemo."/>
<filteritem type="filepath" name="code/DocsSample/Form/FormAddMenuDemo/screenshots/addFormByMenu.png" desc="Provided by code/DocsSample/Form/FormAddMenuDemo."/>
<filteritem type="filepath" name="code/DocsSample/Form/FormAddMenuDemo/entry/src/main/resources/base/media/foreground.png" desc="Provided by code/DocsSample/Form/FormAddMenuDemo."/>
<filteritem type="filepath" name="code/BasicFeature/Native/ArkTSXComponent/entry/src/ohosTest/resources/base/media/icon.png" desc="Provided by the UX team."/>
<filteritem type="filepath" name="code/BasicFeature/Native/ArkTSXComponent/screenshots/device/changeColor.png" desc="Provided by code/BasicFeature/Native/ArkTSXComponent."/>
<filteritem type="filepath" name="code/BasicFeature/Native/ArkTSXComponent/screenshots/device/drawStar.png" desc="Provided by code/BasicFeature/Native/ArkTSXComponent."/>

View File

@ -0,0 +1,11 @@
/node_modules
/oh_modules
/local.properties
/.idea
**/build
/.hvigor
.cxx
/.clangd
/.clang-format
/.clang-tidy
**/.test

View File

@ -0,0 +1,25 @@
/*
* Copyright (C) 2024 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.
*/
{
"app": {
"bundleName": "com.samples.formSample",
"vendor": "samples",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name"
}
}

View File

@ -0,0 +1,8 @@
{
"string": [
{
"name": "app_name",
"value": "Form Sample"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -0,0 +1,81 @@
# Form Kit开发示例
### 介绍
[Form Kit卡片开发服务](https://gitee.com/openharmony/docs/tree/master/zh-cn/application-dev/form)
提供一种界面展示形式,可以将应用的重要信息或操作前置到服务卡片(简称“卡片”),以达到服务直达、减少跳转层级的体验效果。卡片常用于嵌入到其他应用(当前被嵌入方即卡片使用方只支持系统应用,例如桌面)中作为其界面显示的一部分,并支持拉起页面、发送消息等基础的交互能力。
本Sample为卡片提供方的代码即提供卡片的显示内容、控件布局以及控件点击处理逻辑。主要包含以下能力
[FormMenu](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis-arkui/arkui-ts/ohos-arkui-advanced-formmenu.md)
,该功能提供了将卡片添加至桌面的菜单,通过桌面访问该应用快捷卡片,可以直接访问该组件功能。在应用使用过程中,该组件作为留存和复访入口,可吸引用户将功能快捷添加到桌面。
### 效果预览
| 主页 | 通过菜单添加卡片至桌面页面 |
|----------------------------|------------------------------------|
| ![](screenshots/index.png) | ![](screenshots/addFormByMenu.png) |
使用说明:
1.启动Form Sample应用首页正常显示待添加卡片内容。
2.长按主页卡片内容,卡片内容上方显示菜单"添加到桌面"。
3.点击"添加到桌面",退出Form Sample应用到桌面可看到"添加到桌面"卡片。
### 工程目录
```
entry/src/main/ets/
|---entryability
| └---EntryAbility.ets
|---entryformability
| └---EntryFormAbility.ets
|---logger
| └---Logger.ts // 日志工具
└---pages
|---AddFormByMenu.ets // 使用Menu组件添加卡片到桌面
└---Index.ets // 首页
└---widget
└---pages
└---WidgetCard.ets
```
### 具体实现
卡片基础开发能力可通过官方指南文档中的[Form Kit](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/form/formkit-overview.md)
来完成。
本sample中功能主要参考[Menu](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis-arkui/arkui-ts/ts-basic-components-menu.md)
和[FormMenu](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis-arkui/arkui-ts/ohos-arkui-advanced-formmenu.md)
组件,完成功能开发。
### 相关权限
不涉及。
### 依赖
不涉及。
### 约束与限制
1.本示例仅支持标准系统上运行支持设备RK3568。
2.本示例为Stage模型支持API12版本SDKSDK版本号API Version 12 Release
3.本示例需要使用DevEco Studio版本号DevEco Studio 5.0.0 Release及以上版本才可编译运行。
### 下载
如需单独下载本工程,执行如下命令:
```shell
git init
git config core.sparsecheckout true
echo code/DocsSample/Form/ArkTSCardDocsSample/ > .git/info/sparse-checkout
git remote add origin https://gitee.com/openharmony/applications_app_samples.git
git pull origin master
```

View File

@ -0,0 +1,51 @@
/*
* Copyright (C) 2024 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.
*/
{
"app": {
"signingConfigs": [],
"products": [
{
"name": "default",
"signingConfig": "default",
compileSdkVersion: 12,
"compatibleSdkVersion": 12,
"runtimeOS": "OpenHarmony",
}
],
"buildModeSet": [
{
"name": "debug",
},
{
"name": "release"
}
]
},
"modules": [
{
"name": "entry",
"srcPath": "./entry",
"targets": [
{
"name": "default",
"applyToProducts": [
"default"
]
}
]
}
]
}

View File

@ -0,0 +1,6 @@
/node_modules
/oh_modules
/.preview
/build
/.cxx
/.test

View File

@ -0,0 +1,43 @@
/*
* Copyright (C) 2024 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.
*/
{
"apiType": "stageMode",
"buildOption": {
},
"buildOptionSet": [
{
"name": "release",
"arkOptions": {
"obfuscation": {
"ruleOptions": {
"enable": true,
"files": [
"./obfuscation-rules.txt"
]
}
}
}
},
],
"targets": [
{
"name": "default"
},
{
"name": "ohosTest",
}
]
}

View File

@ -0,0 +1,21 @@
/*
* Copyright (C) 2024 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 { hapTasks } from '@ohos/hvigor-ohos-plugin';
export default {
system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
}

View File

@ -0,0 +1,18 @@
# Define project specific obfuscation rules here.
# You can include the obfuscation configuration files in the current module's build-profile.json5.
#
# For more details, see
# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md
# Obfuscation options:
# -disable-obfuscation: disable all obfuscations
# -enable-property-obfuscation: obfuscate the property names
# -enable-toplevel-obfuscation: obfuscate the names in the global scope
# -compact: remove unnecessary blank spaces and all line feeds
# -remove-log: remove all console.* statements
# -print-namecache: print the name cache that contains the mapping from the old names to new names
# -apply-namecache: reuse the given cache file
# Keep options:
# -keep-property-name: specifies property names that you want to keep
# -keep-global-name: specifies names that you want to keep in the global scope

View File

@ -0,0 +1,28 @@
/*
* Copyright (C) 2024 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.
*/
{
"name": "entry",
"version": "1.0.0",
"description": "Please describe the basic information.",
"devDependencies": {
"@ohos/hypium": "1.0.6"
},
"main": "",
"author": "",
"license": "",
"dependencies": {}
}

View File

@ -0,0 +1,58 @@
/*
* Copyright (C) 2024 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 { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
import Logger from '../logger/Logger';
import { window } from '@kit.ArkUI';
const tag = 'En';
export default class EntryAbility extends UIAbility {
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
Logger.info('Ability onCreate');
}
onDestroy(): void {
Logger.info('Ability onDestroy');
}
onWindowStageCreate(windowStage: window.WindowStage): void {
// Main window is created, set main page for this ability
Logger.info('Ability onWindowStageCreate');
windowStage.loadContent('pages/Index', (err) => {
if (err.code) {
Logger.error(`Failed to load the content. Cause: ${JSON.stringify(err)}`);
return;
}
Logger.info('Succeeded in loading the content.');
});
}
onWindowStageDestroy(): void {
// Main window is destroyed, release UI related resources
Logger.info('Ability onWindowStageDestroy');
}
onForeground(): void {
// Ability has brought to foreground
Logger.info('Ability onForeground');
}
onBackground(): void {
// Ability has back to background
Logger.info('Ability onBackground');
}
}

View File

@ -0,0 +1,53 @@
/*
* Copyright (C) 2024 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 { formBindingData, FormExtensionAbility, formInfo } from '@kit.FormKit';
import { Want } from '@kit.AbilityKit';
export default class EntryFormAbility extends FormExtensionAbility {
onAddForm(want: Want) {
// Called to return a FormBindingData object.
let formData: Record<string, string> = {
'city': '未知',
'time': new Date().toLocaleTimeString()
};
return formBindingData.createFormBindingData(formData);
}
onCastToNormalForm(formId: string) {
}
onUpdateForm(formId: string) {
}
onChangeFormVisibility(newStatus: Record<string, number>) {
// Called when the form provider receives form events from the system.
}
onFormEvent(formId: string, message: string) {
// Called when a specified message event defined by the form provider is triggered.
}
onRemoveForm(formId: string) {
}
onAcquireFormState(want: Want) {
// Called to return a {@link FormState} object.
return formInfo.FormState.READY;
}
};

View File

@ -0,0 +1,44 @@
/*
* Copyright (C) 2024 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 { hilog } from '@kit.PerformanceAnalysisKit';
export class Logger {
static domain: number = 0xFF00;
static prefix: string = '[Sample_Add_Form]';
static format: string = '%{public}s, %{public}s';
static debug(...args: string[]): void {
hilog.debug(this.domain, this.prefix, this.format, args);
}
static info(...args: string[]): void {
hilog.info(this.domain, this.prefix, this.format, args);
}
static warn(...args: string[]): void {
hilog.warn(this.domain, this.prefix, this.format, args);
}
static error(...args: string[]): void {
hilog.error(this.domain, this.prefix, this.format, args);
}
static fatal(...args: string[]): void {
hilog.fatal(this.domain, this.prefix, this.format, args);
}
}
export default Logger;

View File

@ -0,0 +1,95 @@
/*
* Copyright (C) 2024 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 { AddFormMenuItem } from '@kit.ArkUI';
import { formBindingData } from '@kit.FormKit';
import Logger from '../logger/Logger';
@Component
export default struct AddFormByMenu {
@State message: string | Resource = $r('app.string.menu_info_long_click');
@State city: string | Resource = $r('app.string.default_city');
@State time: string | Resource = $r('app.string.default_time');
private compId: string = '12345678';
@Builder
myMenu() {
Menu() {
AddFormMenuItem(
{
bundleName: 'com.samples.formSample', // 包名
abilityName: 'EntryFormAbility', // 模块ability名称
parameters: {
'ohos.extra.param.key.form_dimension': 2,
'ohos.extra.param.key.form_name': 'widget',
'ohos.extra.param.key.module_name': 'entry',
},
},
this.compId,
{
formBindingData: formBindingData.createFormBindingData({
'city': this.city,
'time': this.time
}),
// formBindingData: formBindingData.createFormBindingData({ data: 'share' }),
callback: (error, formId) => {
Logger.info('callback infoerror: ' + error + ' formId:' + formId);
},
style: {
options: {
startIcon: $r('app.media.startIcon'), // 菜单图标,可以自己提供。系统默认采用"sys.media.ic_public_add"
content: $r('app.string.add_form'), // 菜单内容,可以自己提供。默认使用"sys.string.ohos_add_form_to_desktop"
// endIcon: $r("app.media.icon") // 菜单图标,可以自己提供
}
}
}
)
}
}
aboutToAppear(): void {
this.time = new Date().toLocaleTimeString();
}
build() {
Row() {
Column() {
Text(this.message)
.margin({ top: 30, bottom: 20 })
Text(this.city)
.fontSize(30)
.margin({ bottom: 20 })
Text(this.time)
.fontSize(30)
.margin({ bottom: 20 })
}
.backgroundImage($r('app.media.CardEvent'))
.backgroundImageSize(ImageSize.Cover)
.id(this.compId)
.width(200)
.height(200)
.borderRadius(10)
.bindContextMenu(this.myMenu, ResponseType.LongPress, {
placement: Placement.TopLeft
})
}
.justifyContent(FlexAlign.Center)
.alignItems(VerticalAlign.Center)
.width('100%')
.height('100%')
}
}

View File

@ -0,0 +1,33 @@
/*
* Copyright (C) 2024 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 AddFormByMenu from './AddFormByMenu';
@Entry
@Component
struct Index {
build() {
Row() {
Column() {
AddFormByMenu()
}
.id('add_form_by_menu')
.backgroundColor(Color.White)
.width('100%')
.height('30%')
}
.height('100%')
}
}

View File

@ -0,0 +1,72 @@
/*
* Copyright (C) 2024 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.
*/
const local = new LocalStorage()
@Entry(local)
@Component
struct WidgetCard {
@LocalStorageProp('city') cityValue: string = ''; // 定义需要刷新的卡片数据
@LocalStorageProp('time') timeValue: string = ''; // 定义需要刷新的卡片数据
/*
* The action type.
*/
readonly ACTION_TYPE: string = 'router';
/*
* The ability name.
*/
readonly ABILITY_NAME: string = 'EntryAbility';
/*
* The message.
*/
readonly MESSAGE: string = 'add detail';
/*
* The width percentage setting.
*/
readonly FULL_WIDTH_PERCENT: string = '100%';
/*
* The height percentage setting.
*/
readonly FULL_HEIGHT_PERCENT: string = '100%';
build() {
Row() {
Column() {
Text(this.cityValue)
.fontSize($r('app.string.font_size'))
.fontWeight(FontWeight.Medium)
.fontColor($r('app.color.item_title_font'))
Text(this.timeValue)
.fontSize($r('app.string.font_size'))
.fontWeight(FontWeight.Medium)
.fontColor($r('app.color.item_title_font'))
}
.alignItems(HorizontalAlign.Center)
.width(this.FULL_WIDTH_PERCENT)
}
.height(this.FULL_HEIGHT_PERCENT)
.backgroundImage($r('app.media.CardEvent'))
.backgroundImageSize({ width: '100%', height: '100%' })
.onClick(() => {
postCardAction(this, {
action: this.ACTION_TYPE,
abilityName: this.ABILITY_NAME,
params: {
message: this.MESSAGE
}
});
})
}
}

View File

@ -0,0 +1,66 @@
/*
* Copyright (C) 2024 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.
*/
{
"module": {
"name": "entry",
"type": "entry",
"description": "$string:module_desc",
"mainElement": "EntryAbility",
"deviceTypes": [
"default"
],
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:main_pages",
"abilities": [
{
"name": "EntryAbility",
"srcEntry": "./ets/entryability/EntryAbility.ets",
"description": "$string:EntryAbility_desc",
"icon": "$media:layered_image",
"label": "$string:EntryAbility_label",
"startWindowIcon": "$media:startIcon",
"startWindowBackground": "$color:start_window_background",
"exported": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
]
}
],
"extensionAbilities": [
{
"name": "EntryFormAbility",
"srcEntry": "./ets/entryformability/EntryFormAbility.ets",
"label": "$string:EntryFormAbility_label",
"description": "$string:EntryFormAbility_desc",
"type": "form",
"metadata": [
{
"name": "ohos.extension.form",
"resource": "$profile:form_config"
}
]
}
]
}
}

View File

@ -0,0 +1,12 @@
{
"color": [
{
"name": "start_window_background",
"value": "#FFFFFF"
},
{
"name": "item_title_font",
"value": "#E6000000"
}
]
}

View File

@ -0,0 +1,8 @@
{
"float": [
{
"name": "font_size",
"value": "25fp"
}
]
}

View File

@ -0,0 +1,52 @@
{
"string": [
{
"name": "module_desc",
"value": "module description"
},
{
"name": "EntryAbility_desc",
"value": "description"
},
{
"name": "EntryAbility_label",
"value": "Form Sample"
},
{
"name": "EntryFormAbility_desc",
"value": "form_description"
},
{
"name": "EntryFormAbility_label",
"value": "form_label"
},
{
"name": "widget_desc",
"value": "This is a service widget."
},
{
"name": "widget_display_name",
"value": "widget"
},
{
"name": "add_form",
"value": "add form"
},
{
"name": "default_city",
"value": "Nanjing"
},
{
"name": "default_time",
"value": "--"
},
{
"name": "menu_info_long_click",
"value": "long click show menu"
},
{
"name": "font_size",
"value": "25fp"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 241 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -0,0 +1,7 @@
{
"layered-image":
{
"background" : "$media:background",
"foreground" : "$media:foreground"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@ -0,0 +1,25 @@
{
"forms": [
{
"name": "widget",
"displayName": "$string:widget_display_name",
"description": "$string:widget_desc",
"src": "./ets/widget/pages/WidgetCard.ets",
"uiSyntax": "arkts",
"window": {
"designWidth": 720,
"autoDesignWidth": true
},
"colorMode": "auto",
"isDynamic": true,
"isDefault": true,
"updateEnabled": false,
"scheduledUpdateTime": "10:30",
"updateDuration": 1,
"defaultDimension": "2*2",
"supportDimensions": [
"2*2"
]
}
]
}

View File

@ -0,0 +1,5 @@
{
"src": [
"pages/Index"
]
}

View File

@ -0,0 +1,52 @@
{
"string": [
{
"name": "module_desc",
"value": "module description"
},
{
"name": "EntryAbility_desc",
"value": "description"
},
{
"name": "EntryAbility_label",
"value": "Form Sample"
},
{
"name": "EntryFormAbility_desc",
"value": "form_description"
},
{
"name": "EntryFormAbility_label",
"value": "form_label"
},
{
"name": "widget_desc",
"value": "This is a service widget."
},
{
"name": "widget_display_name",
"value": "widget"
},
{
"name": "add_form",
"value": "add form"
},
{
"name": "default_city",
"value": "Nanjing"
},
{
"name": "default_time",
"value": "--"
},
{
"name": "menu_info_long_click",
"value": "long click show menu"
},
{
"name": "font_size",
"value": "25fp"
}
]
}

View File

@ -0,0 +1,52 @@
{
"string": [
{
"name": "module_desc",
"value": "模块描述"
},
{
"name": "EntryAbility_desc",
"value": "description"
},
{
"name": "EntryAbility_label",
"value": "Form Sample"
},
{
"name": "EntryFormAbility_desc",
"value": "form_description"
},
{
"name": "EntryFormAbility_label",
"value": "form_label"
},
{
"name": "widget_desc",
"value": "This is a service widget."
},
{
"name": "widget_display_name",
"value": "widget"
},
{
"name": "add_form",
"value": "添加到桌面"
},
{
"name": "default_city",
"value": "南京"
},
{
"name": "default_time",
"value": "--"
},
{
"name": "menu_info_long_click",
"value": "长按显示菜单"
},
{
"name": "font_size",
"value": "25fp"
}
]
}

View File

@ -0,0 +1,44 @@
/*
* Copyright (c) 2024 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 { hilog } from '@kit.PerformanceAnalysisKit';
export class Logger {
static domain: number = 0xFF00;
static prefix: string = '[Sample_Add_Form]';
static format: string = '%{public}s, %{public}s';
static debug(...args: string[]): void {
hilog.debug(this.domain, this.prefix, this.format, args);
}
static info(...args: string[]): void {
hilog.info(this.domain, this.prefix, this.format, args);
}
static warn(...args: string[]): void {
hilog.warn(this.domain, this.prefix, this.format, args);
}
static error(...args: string[]): void {
hilog.error(this.domain, this.prefix, this.format, args);
}
static fatal(...args: string[]): void {
hilog.fatal(this.domain, this.prefix, this.format, args);
}
}
export default Logger;

View File

@ -0,0 +1,68 @@
/*
* Copyright (C) 2024 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 { describe, it, expect } from '@ohos/hypium';
import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
import { Driver, ON } from '@ohos.UiTest';
import { Logger } from '../Logger/Logger';
const TAG = '[Sample_Add_Form]';
const BUNDLE = 'Form Kit';
const driver = Driver.create();
const abilityDelegatorRegistry = AbilityDelegatorRegistry.getAbilityDelegator();
export default function abilityTest() {
describe('FormKitTest', () => {
/**
* 拉起应用
*/
it(BUNDLE + '_StartAbility', 0, async () => {
Logger.info(TAG, BUNDLE + '_StartAbility start');
let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
try {
await abilityDelegator.startAbility({
bundleName: 'com.samples.formSample',
abilityName: 'EntryAbility'
});
} catch (exception) {
Logger.error(TAG, BUNDLE + '_StartAbility error');
expect().assertFail();
}
Logger.info(TAG, BUNDLE + '_StartAbility end');
})
/**
* 通过Menu添加卡片到桌面
*/
it(BUNDLE + '_Add_Form', 0, async () => {
Logger.info(TAG, BUNDLE + '_Add_Form begin');
await driver.delayMs(1000);
let ability = abilityDelegatorRegistry.getAppContext();
let manager = ability.resourceManager;
let btnAccept = await driver.findComponent(ON.id('add_form_by_menu'));
if (btnAccept !== undefined) {
await btnAccept.longClick();
await driver.delayMs(1000);
}
let btnAccept2 = await driver.findComponent(ON.text(await manager.getStringValue($r('app.string.add_form'))));
if (btnAccept2 !== undefined) {
await btnAccept2.click();
await driver.delayMs(1000);
}
Logger.info(TAG, BUNDLE + '_Permission end');
})
})
}

View File

@ -0,0 +1,20 @@
/*
* Copyright (C) 2024 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 abilityTest from './Ability.test';
export default function testsuite() {
abilityTest();
}

View File

@ -0,0 +1,62 @@
/*
* Copyright (C) 2024 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 { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
import { abilityDelegatorRegistry } from '@kit.TestKit';
import { hilog } from '@kit.PerformanceAnalysisKit';
import { window } from '@kit.ArkUI';
import { Hypium } from '@ohos/hypium';
import testsuite from '../test/List.test';
export default class TestAbility extends UIAbility {
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) {
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) ?? '');
let abilityDelegator: abilityDelegatorRegistry.AbilityDelegator;
abilityDelegator = abilityDelegatorRegistry.getAbilityDelegator();
let abilityDelegatorArguments: abilityDelegatorRegistry.AbilityDelegatorArgs;
abilityDelegatorArguments = abilityDelegatorRegistry.getArguments();
hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!');
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite);
}
onDestroy() {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy');
}
onWindowStageCreate(windowStage: window.WindowStage) {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate');
windowStage.loadContent('testability/pages/Index', (err) => {
if (err.code) {
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
return;
}
hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.');
});
}
onWindowStageDestroy() {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy');
}
onForeground() {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground');
}
onBackground() {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground');
}
}

View File

@ -0,0 +1,95 @@
/*
* Copyright (C) 2024 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 { AddFormMenuItem } from '@kit.ArkUI';
import { formBindingData } from '@kit.FormKit';
import Logger from '../../logger/Logger';
@Component
export default struct AddFormByMenu {
@State message: string = '长按显示菜单';
@State city: string = '南京';
@State time: string = '--';
private compId: string = '12345678';
@Builder
myMenu() {
Menu() {
AddFormMenuItem(
{
bundleName: 'com.samples.formSample', // 包名
abilityName: 'EntryAbility', // 模块ability名称
parameters: {
'ohos.extra.param.key.form_dimension': 2,
'ohos.extra.param.key.form_name': 'widget',
'ohos.extra.param.key.module_name': 'entry'
},
},
this.compId,
{
formBindingData: formBindingData.createFormBindingData({
'city': this.city,
'time': this.time
}),
// formBindingData: formBindingData.createFormBindingData({ data: 'share' }),
callback: (error, formId) => {
Logger.info('callback infoerror: ' + error + ' formId:' + formId);
},
style: {
options: {
startIcon: $r('app.media.startIcon'), // 菜单图标,可以自己提供。系统默认采用"sys.media.ic_public_add"
content: $r('app.string.add_form'), // 菜单内容,可以自己提供。默认使用"sys.string.ohos_add_form_to_desktop"
// endIcon: $r("app.media.icon") // 菜单图标,可以自己提供
}
}
}
)
}
}
aboutToAppear(): void {
this.time = new Date().toLocaleTimeString();
}
build() {
Row() {
Column() {
Text(this.message)
.margin({ top: 30, bottom: 20 })
Text(this.city)
.fontSize(30)
.margin({ bottom: 20 })
Text(this.time)
.fontSize(30)
.margin({ bottom: 20 })
}
.backgroundImage($r('app.media.CardEvent'))
.backgroundImageSize(ImageSize.Cover)
.id(this.compId)
.width(200)
.height(200)
.borderRadius(10)
.bindContextMenu(this.myMenu, ResponseType.LongPress, {
placement: Placement.TopLeft
})
}
.justifyContent(FlexAlign.Center)
.alignItems(VerticalAlign.Center)
.width('100%')
.height('100%')
}
}

View File

@ -0,0 +1,33 @@
/*
* Copyright (C) 2024 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 AddFormByMenu from './AddFormByMenu';
@Entry
@Component
struct Index {
build() {
Row() {
Column() {
AddFormByMenu()
}
.id('add_form_by_menu')
.backgroundColor(Color.White)
.width('100%')
.height('30%')
}
.height('100%')
}
}

View File

@ -0,0 +1,92 @@
import { abilityDelegatorRegistry, TestRunner } from '@kit.TestKit';
import { UIAbility, Want } from '@kit.AbilityKit';
import { BusinessError } from '@kit.BasicServicesKit';
import { hilog } from '@kit.PerformanceAnalysisKit';
import { resourceManager } from '@kit.LocalizationKit';
import { util } from '@kit.ArkTS';
let abilityDelegator: abilityDelegatorRegistry.AbilityDelegator;
let abilityDelegatorArguments: abilityDelegatorRegistry.AbilityDelegatorArgs;
let jsonPath: string = 'mock/mock-config.json';
let tag: string = 'testTag';
async function onAbilityCreateCallback(data: UIAbility) {
hilog.info(0x0000, 'testTag', 'onAbilityCreateCallback, data: ${}', JSON.stringify(data));
}
async function addAbilityMonitorCallback(err: BusinessError) {
hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? '');
}
export default class OpenHarmonyTestRunner implements TestRunner {
constructor() {
}
onPrepare() {
hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare');
}
async onRun() {
let tag = 'testTag';
hilog.info(0x0000, tag, '%{public}s', 'OpenHarmonyTestRunner onRun run');
abilityDelegatorArguments = abilityDelegatorRegistry.getArguments()
abilityDelegator = abilityDelegatorRegistry.getAbilityDelegator()
let moduleName = abilityDelegatorArguments.parameters['-m'];
let context = abilityDelegator.getAppContext().getApplicationContext().createModuleContext(moduleName);
let mResourceManager = context.resourceManager;
await checkMock(abilityDelegator, mResourceManager);
const bundleName = abilityDelegatorArguments.bundleName;
const testAbilityName: string = 'TestAbility';
let lMonitor: abilityDelegatorRegistry.AbilityMonitor = {
abilityName: testAbilityName,
onAbilityCreate: onAbilityCreateCallback,
moduleName: moduleName
};
abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback)
const want: Want = {
bundleName: bundleName,
abilityName: testAbilityName,
moduleName: moduleName
};
abilityDelegator.startAbility(want, (err: BusinessError, data: void) => {
hilog.info(0x0000, tag, 'startAbility : err : %{public}s', JSON.stringify(err) ?? '');
hilog.info(0x0000, tag, 'startAbility : data : %{public}s', JSON.stringify(data) ?? '');
})
hilog.info(0x0000, tag, '%{public}s', 'OpenHarmonyTestRunner onRun end');
}
}
async function checkMock(abilityDelegator: abilityDelegatorRegistry.AbilityDelegator,
resourceManager: resourceManager.ResourceManager) {
let rawFile: Uint8Array;
try {
rawFile = resourceManager.getRawFileContentSync(jsonPath);
hilog.info(0x0000, tag, 'MockList file exists');
let mockStr: string = util.TextDecoder.create('utf-8', { ignoreBOM: true }).decodeWithStream(rawFile);
let mockMap: Record<string, string> = getMockList(mockStr);
try {
abilityDelegator.setMockList(mockMap)
} catch (error) {
let code = (error as BusinessError).code;
let message = (error as BusinessError).message;
hilog.error(0x0000, tag, `abilityDelegator.setMockList failed, error code: ${code}, message: ${message}.`);
}
} catch (error) {
let code = (error as BusinessError).code;
let message = (error as BusinessError).message;
hilog.error(0x0000, tag,
`ResourceManager:callback getRawFileContent failed, error code: ${code}, message: ${message}.`);
}
}
function getMockList(jsonStr: string) {
let jsonObj: Record<string, Object> = JSON.parse(jsonStr);
let map: Map<string, object> = new Map<string, object>(Object.entries(jsonObj));
let mockList: Record<string, string> = {};
map.forEach((value: object, key: string) => {
let realValue: string = value['source'].toString();
mockList[key] = realValue;
});
hilog.info(0x0000, tag, '%{public}s', 'mock-json value:' + JSON.stringify(mockList) ?? '');
return mockList;
}

View File

@ -0,0 +1,51 @@
/*
* Copyright (C) 2024 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.
*/
{
"module": {
"name": "entry_test",
"type": "feature",
"description": "$string:module_test_desc",
"mainElement": "TestAbility",
"deviceTypes": [
"default"
],
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:test_pages",
"abilities": [
{
"name": "TestAbility",
"srcEntry": "./ets/testability/TestAbility.ets",
"description": "$string:TestAbility_desc",
"icon": "$media:icon",
"label": "$string:TestAbility_label",
"exported": true,
"startWindowIcon": "$media:icon",
"startWindowBackground": "$color:start_window_background",
"skills": [
{
"actions": [
"action.system.home"
],
"entities": [
"entity.system.home"
]
}
]
}
]
}
}

View File

@ -0,0 +1,8 @@
{
"color": [
{
"name": "start_window_background",
"value": "#FFFFFF"
}
]
}

View File

@ -0,0 +1,24 @@
{
"string": [
{
"name": "module_test_desc",
"value": "test ability description"
},
{
"name": "TestAbility_desc",
"value": "the test ability"
},
{
"name": "TestAbility_label",
"value": "test label"
},
{
"name": "add_form",
"value": "add form"
},
{
"name": "font_size",
"value": "25fp"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -0,0 +1,5 @@
{
"src": [
"testability/pages/Index"
]
}

View File

@ -0,0 +1,20 @@
{
"string": [
{
"name": "module_test_desc",
"value": "test ability description"
},
{
"name": "TestAbility_desc",
"value": "the test ability"
},
{
"name": "TestAbility_label",
"value": "test label"
},
{
"name": "add_form",
"value": "add form"
}
]
}

View File

@ -0,0 +1,20 @@
{
"string": [
{
"name": "module_test_desc",
"value": "test ability description"
},
{
"name": "TestAbility_desc",
"value": "the test ability"
},
{
"name": "TestAbility_label",
"value": "test label"
},
{
"name": "add_form",
"value": "添加到桌面"
}
]
}

View File

@ -0,0 +1,20 @@
/*
* Copyright (C) 2024 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 localUnitTest from './LocalUnit.test';
export default function testsuite() {
localUnitTest();
}

View File

@ -0,0 +1,48 @@
/*
* Copyright (C) 2024 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 { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
export default function localUnitTest() {
describe('localUnitTest',() => {
// Defines a test suite. Two parameters are supported: test suite name and test suite function.
beforeAll(() => {
// 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(() => {
// 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(() => {
// 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(() => {
// 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, () => {
// Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
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);
});
});
}

View File

@ -0,0 +1,36 @@
/*
* Copyright (C) 2024 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.
*/
{
"modelVersion": "5.0.0",
"dependencies": {
},
"execution": {
// "analyze": "default", /* Define the build analyze mode. Value: [ "default" | "verbose" | false ]. Default: "default" */
// "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */
// "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */
// "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */
// "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */
},
"logging": {
// "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */
},
"debugging": {
// "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */
},
"nodeOptions": {
// "maxOldSpaceSize": 4096 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process */
}
}

View File

@ -0,0 +1,21 @@
/*
* Copyright (C) 2024 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 { appTasks } from '@ohos/hvigor-ohos-plugin';
export default {
system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
}

View File

@ -0,0 +1,30 @@
/*
* Copyright (C) 2024 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.
*/
{
"modelVersion": "5.0.0",
"name": "formSample",
"version": "1.0.0",
"description": "Please describe the basic information.",
"main": "",
"author": "",
"license": "",
"dependencies": {
},
"devDependencies": {
// "@ohos/hypium": "1.0.16",
// "@ohos/hamock": "1.0.1-rc2"
}
}

View File

@ -0,0 +1,7 @@
# ArkTSCardDemo测试用例归档
## 用例表
| 测试功能 |预置条件| 输入 | 预期输出 |是否自动|测试结果|
|------------|--------------------------------|-----------------------------------------------|-------------------------------------|--------------------------------|--------------------------------|
| 应用内添加卡片到桌面 | 位于首页 | 1、长按主页中卡片图标。<br/>2、点击"添加到桌面",退出应用到桌面。<br/> | 1、图标左上方弹出菜单"添加到桌面"<br/>2、桌面出现添加的卡片。 |是|Pass|

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB