hh 2 週間 前
コミット
5bb2791a30
42 ファイル変更1084 行追加0 行削除
  1. 1 0
      .gitattributes
  2. 11 0
      .gitignore
  3. 10 0
      AppScope/app.json5
  4. 8 0
      AppScope/resources/base/element/string.json
  5. BIN
      AppScope/resources/base/media/app_icon.png
  6. 36 0
      build-profile.json5
  7. 6 0
      entry/.gitignore
  8. 31 0
      entry/build-profile.json5
  9. 6 0
      entry/hvigorfile.ts
  10. 18 0
      entry/obfuscation-rules.txt
  11. 10 0
      entry/oh-package.json5
  12. 43 0
      entry/src/main/ets/entryability/EntryAbility.ets
  13. 17 0
      entry/src/main/ets/pages/Index.ets
  14. 37 0
      entry/src/main/module.json5
  15. 140 0
      entry/src/main/resources/base/element/color.json
  16. 36 0
      entry/src/main/resources/base/element/font.json
  17. 32 0
      entry/src/main/resources/base/element/font_size.json
  18. 180 0
      entry/src/main/resources/base/element/string.json
  19. BIN
      entry/src/main/resources/base/media/icon.png
  20. BIN
      entry/src/main/resources/base/media/startIcon.png
  21. 5 0
      entry/src/main/resources/base/profile/main_pages.json
  22. 16 0
      entry/src/main/resources/en_US/element/string.json
  23. 16 0
      entry/src/main/resources/zh_CN/element/string.json
  24. 35 0
      entry/src/ohosTest/ets/test/Ability.test.ets
  25. 5 0
      entry/src/ohosTest/ets/test/List.test.ets
  26. 49 0
      entry/src/ohosTest/ets/testability/TestAbility.ets
  27. 17 0
      entry/src/ohosTest/ets/testability/pages/Index.ets
  28. 50 0
      entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ets
  29. 37 0
      entry/src/ohosTest/module.json5
  30. 8 0
      entry/src/ohosTest/resources/base/element/color.json
  31. 16 0
      entry/src/ohosTest/resources/base/element/string.json
  32. BIN
      entry/src/ohosTest/resources/base/media/icon.png
  33. 5 0
      entry/src/ohosTest/resources/base/profile/test_pages.json
  34. 5 0
      entry/src/test/List.test.ets
  35. 33 0
      entry/src/test/LocalUnit.test.ets
  36. 22 0
      hvigor/hvigor-config.json5
  37. 1 0
      hvigor/hvigor-wrapper.js
  38. 6 0
      hvigorfile.ts
  39. 54 0
      hvigorw
  40. 54 0
      hvigorw.bat
  41. 15 0
      oh-package-lock.json5
  42. 13 0
      oh-package.json5

+ 1 - 0
.gitattributes

@@ -0,0 +1 @@
+.preview/*

+ 11 - 0
.gitignore

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

+ 10 - 0
AppScope/app.json5

@@ -0,0 +1,10 @@
+{
+  "app": {
+    "bundleName": "com.hj.hj_openharmony_process",
+    "vendor": "example",
+    "versionCode": 1000000,
+    "versionName": "1.0.0",
+    "icon": "$media:app_icon",
+    "label": "$string:app_name"
+  }
+}

+ 8 - 0
AppScope/resources/base/element/string.json

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

BIN
AppScope/resources/base/media/app_icon.png


+ 36 - 0
build-profile.json5

@@ -0,0 +1,36 @@
+{
+  "app": {
+    "signingConfigs": [],
+    "products": [
+      {
+        "name": "default",
+        "signingConfig": "default",
+        "compileSdkVersion": 10,
+        "compatibleSdkVersion": 10,
+        "runtimeOS": "OpenHarmony",
+      }
+    ],
+    "buildModeSet": [
+      {
+        "name": "debug",
+      },
+      {
+        "name": "release"
+      }
+    ]
+  },
+  "modules": [
+    {
+      "name": "entry",
+      "srcPath": "./entry",
+      "targets": [
+        {
+          "name": "default",
+          "applyToProducts": [
+            "default"
+          ]
+        }
+      ]
+    }
+  ]
+}

+ 6 - 0
entry/.gitignore

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

+ 31 - 0
entry/build-profile.json5

@@ -0,0 +1,31 @@
+{
+  "apiType": "stageMode",
+  "buildOption": {
+    "arkOptions": {
+      // "apPath": "./modules.ap"  /* Profile used for profile-guided optimization (PGO), a compiler optimization technique to improve app runtime performance. */
+    }
+  },
+  "buildOptionSet": [
+    {
+      "name": "release",
+      "arkOptions": {
+        "obfuscation": {
+          "ruleOptions": {
+            "enable": true,
+            "files": [
+              "./obfuscation-rules.txt"
+            ]
+          }
+        }
+      }
+    },
+  ],
+  "targets": [
+    {
+      "name": "default"
+    },
+    {
+      "name": "ohosTest",
+    }
+  ]
+}

+ 6 - 0
entry/hvigorfile.ts

@@ -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. */
+}

+ 18 - 0
entry/obfuscation-rules.txt

@@ -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

+ 10 - 0
entry/oh-package.json5

@@ -0,0 +1,10 @@
+{
+  "name": "entry",
+  "version": "1.0.0",
+  "description": "Please describe the basic information.",
+  "main": "",
+  "author": "",
+  "license": "",
+  "dependencies": {}
+}
+

+ 43 - 0
entry/src/main/ets/entryability/EntryAbility.ets

@@ -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');
+  }
+}

+ 17 - 0
entry/src/main/ets/pages/Index.ets

@@ -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%')
+  }
+}

+ 37 - 0
entry/src/main/module.json5

@@ -0,0 +1,37 @@
+{
+  "module": {
+    "name": "entry",
+    "type": "entry",
+    "description": "$string:module_desc",
+    "mainElement": "EntryAbility",
+    "deviceTypes": [
+      "default",
+      "tablet"
+    ],
+    "deliveryWithInstall": true,
+    "installationFree": false,
+    "pages": "$profile:main_pages",
+    "abilities": [
+      {
+        "name": "EntryAbility",
+        "srcEntry": "./ets/entryability/EntryAbility.ets",
+        "description": "$string:EntryAbility_desc",
+        "icon": "$media:icon",
+        "label": "$string:EntryAbility_label",
+        "startWindowIcon": "$media:startIcon",
+        "startWindowBackground": "$color:start_window_background",
+        "exported": true,
+        "skills": [
+          {
+            "entities": [
+              "entity.system.home"
+            ],
+            "actions": [
+              "action.system.home"
+            ]
+          }
+        ]
+      }
+    ]
+  }
+}

+ 140 - 0
entry/src/main/resources/base/element/color.json

@@ -0,0 +1,140 @@
+{
+  "color": [
+    {
+      "name": "start_window_background",
+      "value": "#FFFFFF"
+    },
+    {
+      "name": "FFFFFF",
+      "value": "#FFFFFF"
+    },
+    {
+      "name": "000000",
+      "value": "#000000"
+    },
+    {
+      "name": "A0A8B2",
+      "value": "#A0A8B2"
+    },
+    {
+      "name": "0A59F7",
+      "value": "#0A59F7"
+    },
+    {
+      "name": "F1F3F5",
+      "value": "#F1F3F5"
+    },
+    {
+      "name": "0A84FF",
+      "value": "#0A84FF"
+    },
+    {
+      "name":"40000000",
+      "value": "#66000000"
+    },
+    {
+      "name":"20000000",
+      "value": "#33000000"
+    },
+    {
+      "name": "30D158",
+      "value": "#30D158"
+    },
+    {
+      "name": "73C3FF",
+      "value": "#73C3FF"
+    },
+    {
+      "name": "1050FF",
+      "value": "#1050FF"
+    },
+    {
+      "name": "FF453A",
+      "value": "#FF453A"
+    },
+    {
+      "name": "E5E5E5",
+      "value": "#E5E5E5"
+    },
+    {
+      "name": "191919",
+      "value": "#191919"
+    },
+    {
+      "name": "FF9F0A",
+      "value": "#FF9F0A"
+    },
+    {
+      "name": "333333",
+      "value": "#333333"
+    },
+    {
+      "name": "20FFFFFF",
+      "value": "#33FFFFFF"
+    },
+    {
+      "name": "10FFFFFF",
+      "value": "#19FFFFFF"
+    },
+    {
+      "name": "90FFFFFF",
+      "value": "#E5FFFFFF"
+    },
+    {
+      "name": "60FFFFFF",
+      "value": "#99FFFFFF"
+    },
+    {
+      "name": "30FFFFFF",
+      "value": "#4DFFFFFF"
+    },
+    {
+      "name": "90000000",
+      "value": "#E5000000"
+    },
+    {
+      "name": "60000000",
+      "value": "#E5000000"
+    },
+    {
+      "name": "99000000",
+      "value": "#99000000"
+    },
+    {
+      "name": "007AFF",
+      "value": "#007AFF"
+    },
+    {
+      "name": "2A2A2A",
+      "value": "#2A2A2A"
+    },
+    {
+      "name": "FFD60A",
+      "value": "#FFD60A"
+    },
+    {
+      "name": "20FFD60A",
+      "value": "#33FFD60A"
+    },
+    {
+      "name": "2064BB5C",
+      "value": "#3364BB5C"
+    },
+    {
+      "name": "64BB5C",
+      "value": "#64BB5C"
+    },
+    {
+      "name": "40FFFFFF",
+      "value": "#66FFFFFF"
+    },
+    {
+      "name": "2030D158",
+      "value": "#3330D158"
+    },
+    {
+      "name": "15FFFFFF",
+      "value": "#26FFFFFF"
+    }
+  ]
+}

+ 36 - 0
entry/src/main/resources/base/element/font.json

@@ -0,0 +1,36 @@
+{
+  "float": [
+    {
+      "name": "virtualSize_56",
+      "value": "33.6vp"
+    },
+    {
+      "name": "virtualSize_48",
+      "value": "28.8vp"
+    },
+    {
+      "name": "virtualSize_32",
+      "value": "25.2vp"
+    },
+    {
+      "name": "virtualSize_24",
+      "value": "14.4vp"
+    },
+    {
+      "name": "virtualSize_20",
+      "value": "12vp"
+    },
+    {
+      "name": "virtualSize_16",
+      "value": "9.6vp"
+    },
+    {
+      "name": "virtualSize_12",
+      "value": "7.2vp"
+    },
+    {
+      "name": "virtualSize_5",
+      "value": "3vp"
+    }
+  ]
+}

+ 32 - 0
entry/src/main/resources/base/element/font_size.json

@@ -0,0 +1,32 @@
+{
+  "float": [
+    {
+      "name": "fontSize_70",
+      "value": "42fp"
+    },
+    {
+      "name": "fontSize_48",
+      "value": "28.8fp"
+    },
+    {
+      "name": "fontSize_38",
+      "value": "22.8fp"
+    },
+    {
+      "name": "fontSize_30",
+      "value": "18fp"
+    },
+    {
+      "name": "fontSize_24",
+      "value": "14.4fp"
+    },
+    {
+      "name": "fontSize_16",
+      "value": "9.6fp"
+    },
+    {
+      "name": "fontSize_12",
+      "value": "7.2fp"
+    }
+  ]
+}

+ 180 - 0
entry/src/main/resources/base/element/string.json

@@ -0,0 +1,180 @@
+{
+  "string": [
+    {
+      "name": "entry_MainAbility",
+      "value": "Launcher"
+    },
+    {
+      "name": "mainability_description",
+      "value": "ETS_Empty Feature Ability"
+    },
+    {
+      "name": "into_settings",
+      "value": "Launcher settings"
+    },
+    {
+      "name": "add_blank_page",
+      "value": "Add Blank Page"
+    },
+    {
+      "name": "delete_blank_page",
+      "value": "Delete Blank Page"
+    },
+    {
+      "name": "layout",
+      "value": "Layout"
+    },
+    {
+      "name": "layout_style",
+      "value": "Layout Style"
+    },
+    {
+      "name": "launcher_layout",
+      "value": "Launcher Layout"
+    },
+    {
+      "name": "recent_tasks_setting",
+      "value": "Recent Tasks Setting"
+    },
+    {
+      "name": "cancel",
+      "value": "Cancel"
+    },
+    {
+      "name": "uninstall",
+      "value": "Uninstall"
+    },
+    {
+      "name": "submit",
+      "value": "Submit"
+    },
+    {
+      "name": "launcher_edit",
+      "value": "Launcher Edit"
+    },
+    {
+      "name": "uninstall_success",
+      "value": "Successfully uninstalled"
+    },
+    {
+      "name": "uninstall_failed",
+      "value": "Uninstallation failed"
+    },
+    {
+      "name": "disable_uninstall",
+      "value": "Disable uninstall"
+    },
+    {
+      "name": "duplicate_add",
+      "value": "Duplicate add to desktop"
+    },
+    {
+      "name": "no_space_for_add",
+      "value": "No Space for add"
+    },
+    {
+      "name": "delete_app",
+      "value": "Delete application"
+    },
+    {
+      "name": "disable_add_to_dock",
+      "value": "Disable add to dock"
+    },
+    {
+      "name": "disable_add_to_delete",
+      "value": "Disable add to delete"
+    },
+    {
+      "name": "add_form_to_desktop",
+      "value": "add widget to desktop"
+    },
+    {
+      "name": "form_center",
+      "value": "Form Center"
+    },
+    {
+      "name": "form_edit",
+      "value": "edit service widget"
+    },
+    {
+      "name": "app_center_menu_add_dock",
+      "value": "add to dock"
+    },
+    {
+      "name": "app_center_menu_add_desktop",
+      "value": "add to desktop"
+    },
+    {
+      "name": "disable_to_move",
+      "value": "disable to move"
+    },
+    {
+      "name": "add",
+      "value": "Add"
+    },
+    {
+      "name": "add_to",
+      "value": "Add to "
+    },
+    {
+      "name": "new_folder_name",
+      "value": "New folder"
+    },
+    {
+      "name": "rename_folder",
+      "value": "Rename"
+    },
+    {
+      "name": "cancel_dialog",
+      "value": "cancel"
+    },
+    {
+      "name": "confirm_dialog",
+      "value": "confirm"
+    },
+    {
+      "name": "add_to_desktop",
+      "value": "add to desktop"
+    },
+    {
+      "name": "add_form_to_desktop_more",
+      "value": "add widget to desktop more"
+    },
+    {
+      "name": "app_center_menu_uninstall",
+      "value": "uninstall"
+    },
+    {
+      "name": "delete_form",
+      "value": "Delete Service Widget"
+    },
+    {
+      "name": "is_delete_form",
+      "value": "Whether to remove "
+    },
+    {
+      "name": "form",
+      "value": "service widget"
+    },
+    {
+      "name": "remove_form_dialog_content",
+      "value": "Long press the application to enter the service widget management page to add a new service widget"
+    },
+    {
+      "name": "gesture_navigation_options",
+      "value": "Gesture Navigation Options"
+    },
+    {
+      "name": "No_running_apps_recently",
+      "value": "no recently running applications"
+    },
+    {
+      "name": "app_menu_open",
+      "value": "open"
+    },
+    {
+      "name": "remove_app_from_folder",
+      "value": "remove app from folder"
+    }
+  ]
+}

BIN
entry/src/main/resources/base/media/icon.png


BIN
entry/src/main/resources/base/media/startIcon.png


+ 5 - 0
entry/src/main/resources/base/profile/main_pages.json

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

+ 16 - 0
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": "label"
+    }
+  ]
+}

+ 16 - 0
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": "label"
+    }
+  ]
+}

+ 35 - 0
entry/src/ohosTest/ets/test/Ability.test.ets

@@ -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 - 0
entry/src/ohosTest/ets/test/List.test.ets

@@ -0,0 +1,5 @@
+import abilityTest from './Ability.test';
+
+export default function testsuite() {
+  abilityTest();
+}

+ 49 - 0
entry/src/ohosTest/ets/testability/TestAbility.ets

@@ -0,0 +1,49 @@
+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';
+import Want from '@ohos.app.ability.Want';
+import AbilityConstant from '@ohos.app.ability.AbilityConstant';
+
+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');
+  }
+}

+ 17 - 0
entry/src/ohosTest/ets/testability/pages/Index.ets

@@ -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%')
+  }
+}

+ 50 - 0
entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ets

@@ -0,0 +1,50 @@
+import hilog from '@ohos.hilog';
+import TestRunner from '@ohos.application.testRunner';
+import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
+import Want from '@ohos.app.ability.Want';
+
+let abilityDelegator: AbilityDelegatorRegistry.AbilityDelegator | undefined = undefined
+let abilityDelegatorArguments: AbilityDelegatorRegistry.AbilityDelegatorArgs | undefined = undefined
+
+async function onAbilityCreateCallback() {
+  hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback');
+}
+
+async function addAbilityMonitorCallback(err : Error) {
+  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() {
+    hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run');
+    abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+    abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+    const bundleName = abilityDelegatorArguments.bundleName;
+    const testAbilityName = 'TestAbility';
+    const moduleName = abilityDelegatorArguments.parameters['-m'];
+    let lMonitor: AbilityDelegatorRegistry.AbilityMonitor = {
+      abilityName: testAbilityName,
+      onAbilityCreate: onAbilityCreateCallback,
+      moduleName: moduleName
+    };
+    abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback)
+    const want: Want = {
+      bundleName: bundleName,
+      abilityName: testAbilityName,
+      moduleName: moduleName
+    };
+    abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
+    abilityDelegator.startAbility(want, (err, data) => {
+      hilog.info(0x0000, 'testTag', 'startAbility : err : %{public}s', JSON.stringify(err) ?? '');
+      hilog.info(0x0000, 'testTag', 'startAbility : data : %{public}s',JSON.stringify(data) ?? '');
+    })
+    hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end');
+  }
+}

+ 37 - 0
entry/src/ohosTest/module.json5

@@ -0,0 +1,37 @@
+{
+  "module": {
+    "name": "entry_test",
+    "type": "feature",
+    "description": "$string:module_test_desc",
+    "mainElement": "TestAbility",
+    "deviceTypes": [
+      "default",
+      "tablet"
+    ],
+    "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"
+            ]
+          }
+        ]
+      }
+    ]
+  }
+}

+ 8 - 0
entry/src/ohosTest/resources/base/element/color.json

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

+ 16 - 0
entry/src/ohosTest/resources/base/element/string.json

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

BIN
entry/src/ohosTest/resources/base/media/icon.png


+ 5 - 0
entry/src/ohosTest/resources/base/profile/test_pages.json

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

+ 5 - 0
entry/src/test/List.test.ets

@@ -0,0 +1,5 @@
+import localUnitTest from './LocalUnit.test';
+
+export default function testsuite() {
+  localUnitTest();
+}

+ 33 - 0
entry/src/test/LocalUnit.test.ets

@@ -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 - 0
hvigor/hvigor-config.json5

@@ -0,0 +1,22 @@
+{
+  "hvigorVersion": "3.2.4",
+  "dependencies": {
+    "@ohos/hvigor-ohos-plugin": "3.2.4"
+  },
+  "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 */
+  }
+}

ファイルの差分が大きいため隠しています
+ 1 - 0
hvigor/hvigor-wrapper.js


+ 6 - 0
hvigorfile.ts

@@ -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. */
+}

+ 54 - 0
hvigorw

@@ -0,0 +1,54 @@
+#!/bin/bash
+
+# ----------------------------------------------------------------------------
+#  Hvigor startup script, version 1.0.0
+#
+#  Required ENV vars:
+#  ------------------
+#    NODE_HOME - location of a Node home dir
+#    or
+#    Add /usr/local/nodejs/bin to the PATH environment variable
+# ----------------------------------------------------------------------------
+
+HVIGOR_APP_HOME="`pwd -P`"
+HVIGOR_WRAPPER_SCRIPT=${HVIGOR_APP_HOME}/hvigor/hvigor-wrapper.js
+#NODE_OPTS="--max-old-space-size=4096"
+
+fail() {
+  echo "$*"
+  exit 1
+}
+
+set_executable_node() {
+  EXECUTABLE_NODE="${NODE_HOME}/bin/node"
+  if [ -x "$EXECUTABLE_NODE" ]; then
+    return
+  fi
+
+  EXECUTABLE_NODE="${NODE_HOME}/node"
+  if [ -x "$EXECUTABLE_NODE" ]; then
+    return
+  fi
+  fail "ERROR: NODE_HOME is set to an invalid directory,check $NODE_HOME\n\nPlease set NODE_HOME in your environment to the location where your nodejs installed"
+}
+
+# Determine node to start hvigor wrapper script
+if [ -n "${NODE_HOME}" ]; then
+  set_executable_node
+else
+  EXECUTABLE_NODE="node"
+  command -v ${EXECUTABLE_NODE} &> /dev/null || fail "ERROR: NODE_HOME not set and 'node' command not found"
+fi
+
+# Check hvigor wrapper script
+if [ ! -r "$HVIGOR_WRAPPER_SCRIPT" ]; then
+  fail "ERROR: Couldn't find hvigor/hvigor-wrapper.js in ${HVIGOR_APP_HOME}"
+fi
+
+if [ -z "${NODE_OPTS}" ]; then
+  NODE_OPTS="--"
+fi
+
+# start hvigor-wrapper script
+exec "${EXECUTABLE_NODE}" "${NODE_OPTS}" \
+  "${HVIGOR_WRAPPER_SCRIPT}" "$@"

+ 54 - 0
hvigorw.bat

@@ -0,0 +1,54 @@
+@rem
+@rem ----------------------------------------------------------------------------
+@rem  Hvigor startup script for Windows, version 1.0.0
+@rem
+@rem  Required ENV vars:
+@rem  ------------------
+@rem    NODE_HOME - location of a Node home dir
+@rem    or
+@rem    Add %NODE_HOME%/bin to the PATH environment variable
+@rem ----------------------------------------------------------------------------
+@rem
+@echo off
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+set WRAPPER_MODULE_PATH=%APP_HOME%\hvigor\hvigor-wrapper.js
+set NODE_EXE=node.exe
+@rem set NODE_OPTS="--max-old-space-size=4096"
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+if not defined NODE_OPTS set NODE_OPTS="--"
+
+@rem Find node.exe
+if defined NODE_HOME (
+  set NODE_HOME=%NODE_HOME:"=%
+  set NODE_EXE_PATH=%NODE_HOME%/%NODE_EXE%
+)
+
+%NODE_EXE% --version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" (
+  "%NODE_EXE%" "%NODE_OPTS%" "%WRAPPER_MODULE_PATH%" %*
+) else if exist "%NODE_EXE_PATH%" (
+  "%NODE_EXE%" "%NODE_OPTS%" "%WRAPPER_MODULE_PATH%" %*
+) else (
+  echo.
+  echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH.
+  echo.
+  echo Please set the NODE_HOME variable in your environment to match the
+  echo location of your NodeJs installation.
+)
+
+if "%ERRORLEVEL%" == "0" (
+  if "%OS%" == "Windows_NT" endlocal
+) else (
+  exit /b %ERRORLEVEL%
+)

+ 15 - 0
oh-package-lock.json5

@@ -0,0 +1,15 @@
+{
+  "lockfileVersion": 2,
+  "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
+  "specifiers": {
+    "@ohos/hypium@1.0.13": "@ohos/hypium@1.0.13"
+  },
+  "packages": {
+    "@ohos/hypium@1.0.13": {
+      "resolved": "https://repo.harmonyos.com/ohpm/@ohos/hypium/-/hypium-1.0.13.tgz",
+      "integrity": "sha512-d0+XvDeAYk5Vgl6JQ8Q1G+NPmTyJI8qgZ1PwPfcUbx/dfyKVAAv9lz1XtVNhYypyWEKqAzu8zMAC9GuHo2Y53Q==",
+      "registryType": "ohpm",
+      "shasum": "88d8dda420097efb98d770bf59616faef4682f06"
+    }
+  }
+}

+ 13 - 0
oh-package.json5

@@ -0,0 +1,13 @@
+{
+  "name": "hj_openharmony_process",
+  "version": "1.0.0",
+  "description": "Please describe the basic information.",
+  "main": "",
+  "author": "",
+  "license": "",
+  "dependencies": {
+  },
+  "devDependencies": {
+    "@ohos/hypium": "1.0.13"
+  }
+}