init: 初始化
This commit is contained in:
		
						commit
						50cea7e87d
					
				
							
								
								
									
										12
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,12 @@ | |||||||
|  | /node_modules | ||||||
|  | /oh_modules | ||||||
|  | /local.properties | ||||||
|  | /.idea | ||||||
|  | **/build | ||||||
|  | /.hvigor | ||||||
|  | .cxx | ||||||
|  | /.clangd | ||||||
|  | /.clang-format | ||||||
|  | /.clang-tidy | ||||||
|  | **/.test | ||||||
|  | /.appanalyzer | ||||||
							
								
								
									
										10
									
								
								AppScope/app.json5
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								AppScope/app.json5
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,10 @@ | |||||||
|  | { | ||||||
|  |   "app": { | ||||||
|  |     "bundleName": "com.oh.myapplication", | ||||||
|  |     "vendor": "example", | ||||||
|  |     "versionCode": 1000000, | ||||||
|  |     "versionName": "1.0.0", | ||||||
|  |     "icon": "$media:app_icon", | ||||||
|  |     "label": "$string:app_name" | ||||||
|  |   } | ||||||
|  | } | ||||||
							
								
								
									
										8
									
								
								AppScope/resources/base/element/string.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								AppScope/resources/base/element/string.json
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,8 @@ | |||||||
|  | { | ||||||
|  |   "string": [ | ||||||
|  |     { | ||||||
|  |       "name": "app_name", | ||||||
|  |       "value": "car_next" | ||||||
|  |     } | ||||||
|  |   ] | ||||||
|  | } | ||||||
							
								
								
									
										
											BIN
										
									
								
								AppScope/resources/base/media/app_icon.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								AppScope/resources/base/media/app_icon.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 2.7 KiB | 
							
								
								
									
										40
									
								
								build-profile.json5
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								build-profile.json5
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,40 @@ | |||||||
|  | { | ||||||
|  |   "app": { | ||||||
|  |     "signingConfigs": [], | ||||||
|  |     "products": [ | ||||||
|  |       { | ||||||
|  |         "name": "default", | ||||||
|  |         "signingConfig": "default", | ||||||
|  |         "compatibleSdkVersion": "4.0.0(10)", | ||||||
|  |         "runtimeOS": "HarmonyOS", | ||||||
|  |         "buildOption": { | ||||||
|  |           "strictMode": { | ||||||
|  |             "caseSensitiveCheck": true, | ||||||
|  |           } | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |     ], | ||||||
|  |     "buildModeSet": [ | ||||||
|  |       { | ||||||
|  |         "name": "debug", | ||||||
|  |       }, | ||||||
|  |       { | ||||||
|  |         "name": "release" | ||||||
|  |       } | ||||||
|  |     ] | ||||||
|  |   }, | ||||||
|  |   "modules": [ | ||||||
|  |     { | ||||||
|  |       "name": "entry", | ||||||
|  |       "srcPath": "./entry", | ||||||
|  |       "targets": [ | ||||||
|  |         { | ||||||
|  |           "name": "default", | ||||||
|  |           "applyToProducts": [ | ||||||
|  |             "default" | ||||||
|  |           ] | ||||||
|  |         } | ||||||
|  |       ] | ||||||
|  |     } | ||||||
|  |   ] | ||||||
|  | } | ||||||
							
								
								
									
										20
									
								
								code-linter.json5
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								code-linter.json5
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,20 @@ | |||||||
|  | { | ||||||
|  |   "files": [ | ||||||
|  |     "**/*.ets" | ||||||
|  |   ], | ||||||
|  |   "ignore": [ | ||||||
|  |     "**/src/ohosTest/**/*", | ||||||
|  |     "**/src/test/**/*", | ||||||
|  |     "**/src/mock/**/*", | ||||||
|  |     "**/node_modules/**/*", | ||||||
|  |     "**/oh_modules/**/*", | ||||||
|  |     "**/build/**/*", | ||||||
|  |     "**/.preview/**/*" | ||||||
|  |   ], | ||||||
|  |   "ruleSet": [ | ||||||
|  |     "plugin:@performance/recommended", | ||||||
|  |     "plugin:@typescript-eslint/recommended" | ||||||
|  |   ], | ||||||
|  |   "rules": { | ||||||
|  |   } | ||||||
|  | } | ||||||
							
								
								
									
										6
									
								
								entry/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								entry/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,6 @@ | |||||||
|  | /node_modules | ||||||
|  | /oh_modules | ||||||
|  | /.preview | ||||||
|  | /build | ||||||
|  | /.cxx | ||||||
|  | /.test | ||||||
							
								
								
									
										28
									
								
								entry/build-profile.json5
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								entry/build-profile.json5
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,28 @@ | |||||||
|  | { | ||||||
|  |   "apiType": "stageMode", | ||||||
|  |   "buildOption": { | ||||||
|  |   }, | ||||||
|  |   "buildOptionSet": [ | ||||||
|  |     { | ||||||
|  |       "name": "release", | ||||||
|  |       "arkOptions": { | ||||||
|  |         "obfuscation": { | ||||||
|  |           "ruleOptions": { | ||||||
|  |             "enable": false, | ||||||
|  |             "files": [ | ||||||
|  |               "./obfuscation-rules.txt" | ||||||
|  |             ] | ||||||
|  |           } | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |   ], | ||||||
|  |   "targets": [ | ||||||
|  |     { | ||||||
|  |       "name": "default" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       "name": "ohosTest", | ||||||
|  |     } | ||||||
|  |   ] | ||||||
|  | } | ||||||
							
								
								
									
										6
									
								
								entry/hvigorfile.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								entry/hvigorfile.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,6 @@ | |||||||
|  | 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. */ | ||||||
|  | } | ||||||
							
								
								
									
										23
									
								
								entry/obfuscation-rules.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								entry/obfuscation-rules.txt
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,23 @@ | |||||||
|  | # 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://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5 | ||||||
|  | 
 | ||||||
|  | # 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 | ||||||
|  | 
 | ||||||
|  | -enable-property-obfuscation | ||||||
|  | -enable-toplevel-obfuscation | ||||||
|  | -enable-filename-obfuscation | ||||||
|  | -enable-export-obfuscation | ||||||
							
								
								
									
										10
									
								
								entry/oh-package.json5
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								entry/oh-package.json5
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,10 @@ | |||||||
|  | { | ||||||
|  |   "name": "entry", | ||||||
|  |   "version": "1.0.0", | ||||||
|  |   "description": "Please describe the basic information.", | ||||||
|  |   "main": "", | ||||||
|  |   "author": "", | ||||||
|  |   "license": "", | ||||||
|  |   "dependencies": {} | ||||||
|  | } | ||||||
|  | 
 | ||||||
							
								
								
									
										43
									
								
								entry/src/main/ets/entryability/EntryAbility.ets
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								entry/src/main/ets/entryability/EntryAbility.ets
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,43 @@ | |||||||
|  | import AbilityConstant from '@ohos.app.ability.AbilityConstant'; | ||||||
|  | import hilog from '@ohos.hilog'; | ||||||
|  | import UIAbility from '@ohos.app.ability.UIAbility'; | ||||||
|  | import Want from '@ohos.app.ability.Want'; | ||||||
|  | import window from '@ohos.window'; | ||||||
|  | 
 | ||||||
|  | export default class EntryAbility extends UIAbility { | ||||||
|  |   onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { | ||||||
|  |     hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   onDestroy(): void { | ||||||
|  |     hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   onWindowStageCreate(windowStage: window.WindowStage): void { | ||||||
|  |     // Main window is created, set main page for this ability | ||||||
|  |     hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); | ||||||
|  | 
 | ||||||
|  |     windowStage.loadContent('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(): void { | ||||||
|  |     // Main window is destroyed, release UI related resources | ||||||
|  |     hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   onForeground(): void { | ||||||
|  |     // Ability has brought to foreground | ||||||
|  |     hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   onBackground(): void { | ||||||
|  |     // Ability has back to background | ||||||
|  |     hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); | ||||||
|  |   } | ||||||
|  | } | ||||||
							
								
								
									
										12
									
								
								entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,12 @@ | |||||||
|  | import hilog from '@ohos.hilog'; | ||||||
|  | import BackupExtensionAbility, { BundleVersion } from '@ohos.application.BackupExtensionAbility'; | ||||||
|  | 
 | ||||||
|  | export default class EntryBackupAbility extends BackupExtensionAbility { | ||||||
|  |   async onBackup() { | ||||||
|  |     hilog.info(0x0000, 'testTag', 'onBackup ok'); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   async onRestore(bundleVersion: BundleVersion) { | ||||||
|  |     hilog.info(0x0000, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion)); | ||||||
|  |   } | ||||||
|  | } | ||||||
							
								
								
									
										17
									
								
								entry/src/main/ets/pages/Index.ets
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								entry/src/main/ets/pages/Index.ets
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,17 @@ | |||||||
|  | @Entry | ||||||
|  | @Component | ||||||
|  | struct Index { | ||||||
|  |   @State message: string = 'Hello World'; | ||||||
|  | 
 | ||||||
|  |   build() { | ||||||
|  |     Row() { | ||||||
|  |       Column() { | ||||||
|  |         Text(this.message) | ||||||
|  |           .fontSize(50) | ||||||
|  |           .fontWeight(FontWeight.Bold) | ||||||
|  |       } | ||||||
|  |       .width('100%') | ||||||
|  |     } | ||||||
|  |     .height('100%') | ||||||
|  |   } | ||||||
|  | } | ||||||
							
								
								
									
										52
									
								
								entry/src/main/module.json5
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								entry/src/main/module.json5
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,52 @@ | |||||||
|  | { | ||||||
|  |   "module": { | ||||||
|  |     "name": "entry", | ||||||
|  |     "type": "entry", | ||||||
|  |     "description": "$string:module_desc", | ||||||
|  |     "mainElement": "EntryAbility", | ||||||
|  |     "deviceTypes": [ | ||||||
|  |       "phone", | ||||||
|  |       "tablet", | ||||||
|  |       "2in1" | ||||||
|  |     ], | ||||||
|  |     "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": "EntryBackupAbility", | ||||||
|  |         "srcEntry": "./ets/entrybackupability/EntryBackupAbility.ets", | ||||||
|  |         "type": "backup", | ||||||
|  |         "exported": false, | ||||||
|  |         "metadata": [ | ||||||
|  |           { | ||||||
|  |             "name": "ohos.extension.backup", | ||||||
|  |             "resource": "$profile:backup_config" | ||||||
|  |           } | ||||||
|  |         ], | ||||||
|  |       } | ||||||
|  |     ] | ||||||
|  |   } | ||||||
|  | } | ||||||
							
								
								
									
										8
									
								
								entry/src/main/resources/base/element/color.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								entry/src/main/resources/base/element/color.json
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,8 @@ | |||||||
|  | { | ||||||
|  |   "color": [ | ||||||
|  |     { | ||||||
|  |       "name": "start_window_background", | ||||||
|  |       "value": "#FFFFFF" | ||||||
|  |     } | ||||||
|  |   ] | ||||||
|  | } | ||||||
							
								
								
									
										16
									
								
								entry/src/main/resources/base/element/string.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								entry/src/main/resources/base/element/string.json
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,16 @@ | |||||||
|  | { | ||||||
|  |   "string": [ | ||||||
|  |     { | ||||||
|  |       "name": "module_desc", | ||||||
|  |       "value": "module description" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       "name": "EntryAbility_desc", | ||||||
|  |       "value": "description" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       "name": "EntryAbility_label", | ||||||
|  |       "value": "label" | ||||||
|  |     } | ||||||
|  |   ] | ||||||
|  | } | ||||||
							
								
								
									
										
											BIN
										
									
								
								entry/src/main/resources/base/media/background.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								entry/src/main/resources/base/media/background.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 56 KiB | 
							
								
								
									
										
											BIN
										
									
								
								entry/src/main/resources/base/media/foreground.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								entry/src/main/resources/base/media/foreground.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 12 KiB | 
							
								
								
									
										7
									
								
								entry/src/main/resources/base/media/layered_image.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								entry/src/main/resources/base/media/layered_image.json
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,7 @@ | |||||||
|  | { | ||||||
|  |   "layered-image": | ||||||
|  |   { | ||||||
|  |     "background" : "$media:background", | ||||||
|  |     "foreground" : "$media:foreground" | ||||||
|  |   } | ||||||
|  | } | ||||||
							
								
								
									
										
											BIN
										
									
								
								entry/src/main/resources/base/media/startIcon.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								entry/src/main/resources/base/media/startIcon.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 20 KiB | 
							
								
								
									
										3
									
								
								entry/src/main/resources/base/profile/backup_config.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								entry/src/main/resources/base/profile/backup_config.json
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,3 @@ | |||||||
|  | { | ||||||
|  |   "allowToBackupRestore": true | ||||||
|  | } | ||||||
							
								
								
									
										5
									
								
								entry/src/main/resources/base/profile/main_pages.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								entry/src/main/resources/base/profile/main_pages.json
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,5 @@ | |||||||
|  | { | ||||||
|  |   "src": [ | ||||||
|  |     "pages/Index" | ||||||
|  |   ] | ||||||
|  | } | ||||||
							
								
								
									
										16
									
								
								entry/src/main/resources/en_US/element/string.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								entry/src/main/resources/en_US/element/string.json
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,16 @@ | |||||||
|  | { | ||||||
|  |   "string": [ | ||||||
|  |     { | ||||||
|  |       "name": "module_desc", | ||||||
|  |       "value": "module description" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       "name": "EntryAbility_desc", | ||||||
|  |       "value": "description" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       "name": "EntryAbility_label", | ||||||
|  |       "value": "label" | ||||||
|  |     } | ||||||
|  |   ] | ||||||
|  | } | ||||||
							
								
								
									
										16
									
								
								entry/src/main/resources/zh_CN/element/string.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								entry/src/main/resources/zh_CN/element/string.json
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,16 @@ | |||||||
|  | { | ||||||
|  |   "string": [ | ||||||
|  |     { | ||||||
|  |       "name": "module_desc", | ||||||
|  |       "value": "模块描述" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       "name": "EntryAbility_desc", | ||||||
|  |       "value": "description" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |       "name": "EntryAbility_label", | ||||||
|  |       "value": "label" | ||||||
|  |     } | ||||||
|  |   ] | ||||||
|  | } | ||||||
							
								
								
									
										35
									
								
								entry/src/ohosTest/ets/test/Ability.test.ets
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								entry/src/ohosTest/ets/test/Ability.test.ets
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,35 @@ | |||||||
|  | import hilog from '@ohos.hilog'; | ||||||
|  | import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; | ||||||
|  | 
 | ||||||
|  | export default function abilityTest() { | ||||||
|  |   describe('ActsAbilityTest', () => { | ||||||
|  |     // 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. | ||||||
|  |       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); | ||||||
|  |     }) | ||||||
|  |   }) | ||||||
|  | } | ||||||
							
								
								
									
										5
									
								
								entry/src/ohosTest/ets/test/List.test.ets
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								entry/src/ohosTest/ets/test/List.test.ets
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,5 @@ | |||||||
|  | import abilityTest from './Ability.test'; | ||||||
|  | 
 | ||||||
|  | export default function testsuite() { | ||||||
|  |   abilityTest(); | ||||||
|  | } | ||||||
							
								
								
									
										13
									
								
								entry/src/ohosTest/module.json5
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								entry/src/ohosTest/module.json5
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,13 @@ | |||||||
|  | { | ||||||
|  |   "module": { | ||||||
|  |     "name": "entry_test", | ||||||
|  |     "type": "feature", | ||||||
|  |     "deviceTypes": [ | ||||||
|  |       "phone", | ||||||
|  |       "tablet", | ||||||
|  |       "2in1" | ||||||
|  |     ], | ||||||
|  |     "deliveryWithInstall": true, | ||||||
|  |     "installationFree": false | ||||||
|  |   } | ||||||
|  | } | ||||||
							
								
								
									
										5
									
								
								entry/src/test/List.test.ets
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								entry/src/test/List.test.ets
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,5 @@ | |||||||
|  | import localUnitTest from './LocalUnit.test'; | ||||||
|  | 
 | ||||||
|  | export default function testsuite() { | ||||||
|  |   localUnitTest(); | ||||||
|  | } | ||||||
							
								
								
									
										33
									
								
								entry/src/test/LocalUnit.test.ets
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								entry/src/test/LocalUnit.test.ets
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,33 @@ | |||||||
|  | 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); | ||||||
|  |     }); | ||||||
|  |   }); | ||||||
|  | } | ||||||
							
								
								
									
										22
									
								
								hvigor/hvigor-config.json5
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								hvigor/hvigor-config.json5
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,22 @@ | |||||||
|  | { | ||||||
|  |   "modelVersion": "5.0.0", | ||||||
|  |   "dependencies": { | ||||||
|  |   }, | ||||||
|  |   "execution": { | ||||||
|  |     // "analyze": "normal",                     /* Define the build analyze mode. Value: [ "normal" | "advanced" | false ]. Default: "normal" */ | ||||||
|  |     // "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": 8192                  /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process. Default: 8192*/ | ||||||
|  |     // "exposeGC": true                         /* Enable to trigger garbage collection explicitly. Default: true*/ | ||||||
|  |   } | ||||||
|  | } | ||||||
							
								
								
									
										6
									
								
								hvigorfile.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								hvigorfile.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,6 @@ | |||||||
|  | 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. */ | ||||||
|  | } | ||||||
							
								
								
									
										19
									
								
								oh-package-lock.json5
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								oh-package-lock.json5
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,19 @@ | |||||||
|  | { | ||||||
|  |   "meta": { | ||||||
|  |     "stableOrder": true | ||||||
|  |   }, | ||||||
|  |   "lockfileVersion": 3, | ||||||
|  |   "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", | ||||||
|  |   "specifiers": { | ||||||
|  |     "@ohos/hypium@1.0.19": "@ohos/hypium@1.0.19" | ||||||
|  |   }, | ||||||
|  |   "packages": { | ||||||
|  |     "@ohos/hypium@1.0.19": { | ||||||
|  |       "name": "@ohos/hypium", | ||||||
|  |       "version": "1.0.19", | ||||||
|  |       "integrity": "sha512-cEjDgLFCm3cWZDeRXk7agBUkPqjWxUo6AQeiu0gEkb3J8ESqlduQLSIXeo3cCsm8U/asL7iKjF85ZyOuufAGSQ==", | ||||||
|  |       "resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/hypium/-/hypium-1.0.19.har", | ||||||
|  |       "registryType": "ohpm" | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | } | ||||||
							
								
								
									
										9
									
								
								oh-package.json5
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								oh-package.json5
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,9 @@ | |||||||
|  | { | ||||||
|  |   "modelVersion": "5.0.0", | ||||||
|  |   "description": "Please describe the basic information.", | ||||||
|  |   "dependencies": { | ||||||
|  |   }, | ||||||
|  |   "devDependencies": { | ||||||
|  |     "@ohos/hypium": "1.0.19" | ||||||
|  |   } | ||||||
|  | } | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user