Showing
70 changed files
with
1549 additions
and
30 deletions
.DS_Store
deleted
100644 → 0
No preview for this file type
OAT.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!-- Copyright (c) 2021 Huawei Device Co., Ltd. | ||
3 | + | ||
4 | + Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + you may not use this file except in compliance with the License. | ||
6 | + You may obtain a copy of the License at | ||
7 | + | ||
8 | + http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + | ||
10 | + Unless required by applicable law or agreed to in writing, software | ||
11 | + distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + See the License for the specific language governing permissions and | ||
14 | + limitations under the License. | ||
15 | + | ||
16 | + This is the configuration file template for OpenHarmony OSS Audit Tool, please copy it to your project root dir and modify it refer to OpenHarmony/tools_oat/README. | ||
17 | + | ||
18 | +--> | ||
19 | + | ||
20 | +<configuration> | ||
21 | + <oatconfig> | ||
22 | + <licensefile></licensefile> | ||
23 | + <policylist> | ||
24 | + <policy | ||
25 | + desc="" | ||
26 | + name="projectPolicy"> | ||
27 | + <policyitem | ||
28 | + desc="" | ||
29 | + filefilter="copyrightPolicyFilter" | ||
30 | + group="defaultGroup" | ||
31 | + name="SwanLink (Jiangsu) Technology Development Co., LTD." | ||
32 | + path=".*" | ||
33 | + rule="may" | ||
34 | + type="copyright"/> | ||
35 | + <policyitem type="license" name="BSD-3-Clause" path=".*" filefilter="defaultPolicyFilter" desc="不影响兼容性"/> | ||
36 | + <policyitem type="license" name="BSD 3-Clause License" path=".*" filefilter="defaultPolicyFilter" desc="不影响兼容性"/> | ||
37 | + <policyitem type="license" name="BSD-2-Clause" path=".*" filefilter="defaultPolicyFilter" desc="不影响兼容性"/> | ||
38 | + <policyitem type="license" name="BSD 2-Clause License" path=".*" filefilter="defaultPolicyFilter" desc="不影响兼容性"/> | ||
39 | + <policyitem type="compatibility" name="BSD-3-Clause" path=".*" desc="不影响兼容性"/> | ||
40 | + <policyitem type="compatibility" name="BSD-2-Clause" path=".*" desc="不影响兼容性"/> | ||
41 | + <policyitem type="license" name="BSDStyleLicense" path=".*" filefilter="defaultPolicyFilter" desc="不影响兼容性"/> | ||
42 | + </policy> | ||
43 | + <policy name="projectPolicy" desc=""> | ||
44 | + <!--policyitem type="compatibility" name="GPL-2.0+" path=".*" desc="Process that runs independently, invoked by the X process."/--> | ||
45 | + <policyitem type="compatibility" name="GPL-2.0+" path=".*" desc="Process that runs independently, invoked by the X process."/> | ||
46 | + <policyitem type="compatibility" name="Apache-2.0" path=".*" desc="不影响兼容性"/> | ||
47 | + <policyitem type="compatibility" name="BSDStyleLicense" path=".*" desc="不影响兼容性" /> | ||
48 | + <!--policyitem type="copyright" name="xxx" path=".*" rule="may" group="defaultGroup" filefilter="copyrightPolicyFilter" desc="Developed by X Company"/--> | ||
49 | + </policy> | ||
50 | + </policylist> | ||
51 | + <filefilterlist> | ||
52 | + <filefilter name="defaultFilter" desc="Files not to check"> | ||
53 | + <filteritem type="filename" name="*.iml|*.json|*.txt|*.json5|*.yaml|*.md|*.bat" desc="desc files"/> | ||
54 | + <filteritem type="filename" name="*.png|*.ico|*.jpg|*.webp|*.ttf|*.enc|*.mp3" desc="app resource files"/> | ||
55 | + <filteritem type="filename" name="*.so|*.har" desc="engine二进制文件,不影响兼容性"/> | ||
56 | + <filteritem type="filename" name="*.tgz" desc="hvigor本地插件,不影响兼容性"/> | ||
57 | + <filteritem type="filepath" name="*/android/" desc="安卓目录,不影响兼容性"/> | ||
58 | + <filteritem type="filepath" name="*/ios/" desc="ios目录,不影响兼容性"/> | ||
59 | + <filteritem type="filepath" name="*/example/android/" desc="安卓目录,不影响兼容性"/> | ||
60 | + <filteritem type="filepath" name="*/example/ios/" desc="ios目录,不影响兼容性"/> | ||
61 | + </filefilter> | ||
62 | + <filefilter name="defaultPolicyFilter" desc="Filters for compatibility,license header policies"> | ||
63 | + <!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/--> | ||
64 | + <!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/--> | ||
65 | + <!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/--> | ||
66 | + </filefilter> | ||
67 | + <filefilter name="copyrightPolicyFilter" desc="Filters for copyright header policies"> | ||
68 | + <!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/--> | ||
69 | + <!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/--> | ||
70 | + <!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/--> | ||
71 | + </filefilter> | ||
72 | + <filefilter name="licenseFileNamePolicyFilter" desc="Filters for LICENSE file policies"> | ||
73 | + <!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/--> | ||
74 | + <!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/--> | ||
75 | + <!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/--> | ||
76 | + </filefilter> | ||
77 | + <filefilter name="readmeFileNamePolicyFilter" desc="Filters for README file policies"> | ||
78 | + <!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/--> | ||
79 | + <!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/--> | ||
80 | + <!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/--> | ||
81 | + </filefilter> | ||
82 | + <filefilter name="readmeOpenSourcefileNamePolicyFilter" desc="Filters for README.OpenSource file policies"> | ||
83 | + <!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/--> | ||
84 | + <!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/--> | ||
85 | + <!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/--> | ||
86 | + </filefilter> | ||
87 | + <filefilter name="binaryFileTypePolicyFilter" desc="Filters for binary file policies"> | ||
88 | + <filteritem type="filename" name="*.iml|*.json|*.txt" desc="desc files"/> | ||
89 | + <filteritem type='filepath' name="*/example/ohos/entry/libs/arm64-v8a/libc++_shared.so" desc='二进制文件,不影响兼容性'/> | ||
90 | + <filteritem type='filepath' name="ohos/AppScope/resources/base/media/app_icon.png" desc='二进制文件,不影响兼容性'/> | ||
91 | + </filefilter> | ||
92 | + | ||
93 | + </filefilterlist> | ||
94 | + <licensematcherlist> | ||
95 | + <!--licensematcher name="uvwxyz License" desc="If the scanning result is InvalidLicense, you can define matching rules here. Note that quotation marks must be escaped."> | ||
96 | + <licensetext name=" | ||
97 | + uvwxyz license textA xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | ||
98 | + " desc=""/> | ||
99 | + <licensetext name=" | ||
100 | + uvwxyz license textB xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | ||
101 | + " desc=""/> | ||
102 | + </licensematcher--> | ||
103 | + </licensematcherlist> | ||
104 | + </oatconfig> | ||
105 | +</configuration> |
example/ohos/.gitignore
0 → 100644
1 | +/node_modules | ||
2 | +/oh_modules | ||
3 | +/local.properties | ||
4 | +/.idea | ||
5 | +**/build | ||
6 | +/.hvigor | ||
7 | +.cxx | ||
8 | +/.clangd | ||
9 | +/.clang-format | ||
10 | +/.clang-tidy | ||
11 | +**/.test | ||
12 | +*.har | ||
13 | +**/BuildProfile.ets | ||
14 | +**/oh-package-lock.json5 | ||
15 | + | ||
16 | +**/src/main/resources/rawfile/flutter_assets/ | ||
17 | +**/libs/arm64-v8a/libapp.so | ||
18 | +**/libs/arm64-v8a/libflutter.so | ||
19 | +**/libs/arm64-v8a/libvmservice_snapshot.so |
example/ohos/AppScope/app.json5
0 → 100644

6.63 KB
example/ohos/build-profile.json5
0 → 100644
1 | +/* | ||
2 | +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. | ||
3 | +* Licensed under the Apache License, Version 2.0 (the "License"); | ||
4 | +* you may not use this file except in compliance with the License. | ||
5 | +* You may obtain a copy of the License at | ||
6 | +* | ||
7 | +* http://www.apache.org/licenses/LICENSE-2.0 | ||
8 | +* | ||
9 | +* Unless required by applicable law or agreed to in writing, software | ||
10 | +* distributed under the License is distributed on an "AS IS" BASIS, | ||
11 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
12 | +* See the License for the specific language governing permissions and | ||
13 | +* limitations under the License. | ||
14 | +*/ | ||
15 | + | ||
16 | +{ | ||
17 | + "app": { | ||
18 | + "signingConfigs": [], | ||
19 | + "products": [ | ||
20 | + { | ||
21 | + "name": "default", | ||
22 | + "signingConfig": "default", | ||
23 | + "compatibleSdkVersion": "5.0.0(12)", | ||
24 | + "runtimeOS": "HarmonyOS", | ||
25 | + } | ||
26 | + ] | ||
27 | + }, | ||
28 | + "modules": [ | ||
29 | + { | ||
30 | + "name": "entry", | ||
31 | + "srcPath": "./entry", | ||
32 | + "targets": [ | ||
33 | + { | ||
34 | + "name": "default", | ||
35 | + "applyToProducts": [ | ||
36 | + "default" | ||
37 | + ] | ||
38 | + } | ||
39 | + ] | ||
40 | + } | ||
41 | + ] | ||
42 | +} |
example/ohos/entry/.gitignore
0 → 100644
example/ohos/entry/build-profile.json5
0 → 100644
1 | +/* | ||
2 | +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. | ||
3 | +* Licensed under the Apache License, Version 2.0 (the "License"); | ||
4 | +* you may not use this file except in compliance with the License. | ||
5 | +* You may obtain a copy of the License at | ||
6 | +* | ||
7 | +* http://www.apache.org/licenses/LICENSE-2.0 | ||
8 | +* | ||
9 | +* Unless required by applicable law or agreed to in writing, software | ||
10 | +* distributed under the License is distributed on an "AS IS" BASIS, | ||
11 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
12 | +* See the License for the specific language governing permissions and | ||
13 | +* limitations under the License. | ||
14 | +*/ | ||
15 | + | ||
16 | +{ | ||
17 | + "apiType": 'stageMode', | ||
18 | + "buildOption": { | ||
19 | + }, | ||
20 | + "targets": [ | ||
21 | + { | ||
22 | + "name": "default", | ||
23 | + "runtimeOS": "HarmonyOS" | ||
24 | + }, | ||
25 | + { | ||
26 | + "name": "ohosTest", | ||
27 | + } | ||
28 | + ] | ||
29 | +} |
example/ohos/entry/hvigorfile.ts
0 → 100644
1 | +/* | ||
2 | +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. | ||
3 | +* Licensed under the Apache License, Version 2.0 (the "License"); | ||
4 | +* you may not use this file except in compliance with the License. | ||
5 | +* You may obtain a copy of the License at | ||
6 | +* | ||
7 | +* http://www.apache.org/licenses/LICENSE-2.0 | ||
8 | +* | ||
9 | +* Unless required by applicable law or agreed to in writing, software | ||
10 | +* distributed under the License is distributed on an "AS IS" BASIS, | ||
11 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
12 | +* See the License for the specific language governing permissions and | ||
13 | +* limitations under the License. | ||
14 | +*/ | ||
15 | + | ||
16 | +// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. | ||
17 | +export { hapTasks } from '@ohos/hvigor-ohos-plugin'; |
example/ohos/entry/oh-package.json5
0 → 100644
1 | +/* | ||
2 | +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. | ||
3 | +* Licensed under the Apache License, Version 2.0 (the "License"); | ||
4 | +* you may not use this file except in compliance with the License. | ||
5 | +* You may obtain a copy of the License at | ||
6 | +* | ||
7 | +* http://www.apache.org/licenses/LICENSE-2.0 | ||
8 | +* | ||
9 | +* Unless required by applicable law or agreed to in writing, software | ||
10 | +* distributed under the License is distributed on an "AS IS" BASIS, | ||
11 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
12 | +* See the License for the specific language governing permissions and | ||
13 | +* limitations under the License. | ||
14 | +*/ | ||
15 | + | ||
16 | +import { FlutterAbility, FlutterEngine } from '@ohos/flutter_ohos'; | ||
17 | +import { GeneratedPluginRegistrant } from '../plugins/GeneratedPluginRegistrant'; | ||
18 | + | ||
19 | +export default class EntryAbility extends FlutterAbility { | ||
20 | + configureFlutterEngine(flutterEngine: FlutterEngine) { | ||
21 | + super.configureFlutterEngine(flutterEngine) | ||
22 | + GeneratedPluginRegistrant.registerWith(flutterEngine) | ||
23 | + } | ||
24 | +} |
1 | +/* | ||
2 | +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. | ||
3 | +* Licensed under the Apache License, Version 2.0 (the "License"); | ||
4 | +* you may not use this file except in compliance with the License. | ||
5 | +* You may obtain a copy of the License at | ||
6 | +* | ||
7 | +* http://www.apache.org/licenses/LICENSE-2.0 | ||
8 | +* | ||
9 | +* Unless required by applicable law or agreed to in writing, software | ||
10 | +* distributed under the License is distributed on an "AS IS" BASIS, | ||
11 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
12 | +* See the License for the specific language governing permissions and | ||
13 | +* limitations under the License. | ||
14 | +*/ | ||
15 | + | ||
16 | +import common from '@ohos.app.ability.common'; | ||
17 | +import { FlutterPage } from '@ohos/flutter_ohos' | ||
18 | + | ||
19 | +let storage = LocalStorage.getShared() | ||
20 | +const EVENT_BACK_PRESS = 'EVENT_BACK_PRESS' | ||
21 | + | ||
22 | +@Entry(storage) | ||
23 | +@Component | ||
24 | +struct Index { | ||
25 | + private context = getContext(this) as common.UIAbilityContext | ||
26 | + @LocalStorageLink('viewId') viewId: string = ""; | ||
27 | + | ||
28 | + build() { | ||
29 | + Column() { | ||
30 | + FlutterPage({ viewId: this.viewId }) | ||
31 | + } | ||
32 | + } | ||
33 | + | ||
34 | + onBackPress(): boolean { | ||
35 | + this.context.eventHub.emit(EVENT_BACK_PRESS) | ||
36 | + return true | ||
37 | + } | ||
38 | +} |
example/ohos/entry/src/main/module.json5
0 → 100644
1 | +/* | ||
2 | +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. | ||
3 | +* Licensed under the Apache License, Version 2.0 (the "License"); | ||
4 | +* you may not use this file except in compliance with the License. | ||
5 | +* You may obtain a copy of the License at | ||
6 | +* | ||
7 | +* http://www.apache.org/licenses/LICENSE-2.0 | ||
8 | +* | ||
9 | +* Unless required by applicable law or agreed to in writing, software | ||
10 | +* distributed under the License is distributed on an "AS IS" BASIS, | ||
11 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
12 | +* See the License for the specific language governing permissions and | ||
13 | +* limitations under the License. | ||
14 | +*/ | ||
15 | +{ | ||
16 | + "module": { | ||
17 | + "name": "entry", | ||
18 | + "type": "entry", | ||
19 | + "description": "$string:module_desc", | ||
20 | + "mainElement": "EntryAbility", | ||
21 | + "deviceTypes": [ | ||
22 | + "phone" | ||
23 | + ], | ||
24 | + "deliveryWithInstall": true, | ||
25 | + "installationFree": false, | ||
26 | + "pages": "$profile:main_pages", | ||
27 | + "abilities": [ | ||
28 | + { | ||
29 | + "name": "EntryAbility", | ||
30 | + "srcEntry": "./ets/entryability/EntryAbility.ets", | ||
31 | + "description": "$string:EntryAbility_desc", | ||
32 | + "icon": "$media:icon", | ||
33 | + "label": "$string:EntryAbility_label", | ||
34 | + "startWindowIcon": "$media:icon", | ||
35 | + "startWindowBackground": "$color:start_window_background", | ||
36 | + "exported": true, | ||
37 | + "skills": [ | ||
38 | + { | ||
39 | + "entities": [ | ||
40 | + "entity.system.home" | ||
41 | + ], | ||
42 | + "actions": [ | ||
43 | + "action.system.home" | ||
44 | + ] | ||
45 | + } | ||
46 | + ] | ||
47 | + } | ||
48 | + ], | ||
49 | + "requestPermissions": [ | ||
50 | + {"name" : "ohos.permission.INTERNET"}, | ||
51 | + ] | ||
52 | + } | ||
53 | +} |

6.63 KB
1 | +/* | ||
2 | +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. | ||
3 | +* Licensed under the Apache License, Version 2.0 (the "License"); | ||
4 | +* you may not use this file except in compliance with the License. | ||
5 | +* You may obtain a copy of the License at | ||
6 | +* | ||
7 | +* http://www.apache.org/licenses/LICENSE-2.0 | ||
8 | +* | ||
9 | +* Unless required by applicable law or agreed to in writing, software | ||
10 | +* distributed under the License is distributed on an "AS IS" BASIS, | ||
11 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
12 | +* See the License for the specific language governing permissions and | ||
13 | +* limitations under the License. | ||
14 | +*/ | ||
15 | + | ||
16 | +import hilog from '@ohos.hilog'; | ||
17 | +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' | ||
18 | + | ||
19 | +export default function abilityTest() { | ||
20 | + describe('ActsAbilityTest', function () { | ||
21 | + // Defines a test suite. Two parameters are supported: test suite name and test suite function. | ||
22 | + beforeAll(function () { | ||
23 | + // Presets an action, which is performed only once before all test cases of the test suite start. | ||
24 | + // This API supports only one parameter: preset action function. | ||
25 | + }) | ||
26 | + beforeEach(function () { | ||
27 | + // Presets an action, which is performed before each unit test case starts. | ||
28 | + // The number of execution times is the same as the number of test cases defined by **it**. | ||
29 | + // This API supports only one parameter: preset action function. | ||
30 | + }) | ||
31 | + afterEach(function () { | ||
32 | + // Presets a clear action, which is performed after each unit test case ends. | ||
33 | + // The number of execution times is the same as the number of test cases defined by **it**. | ||
34 | + // This API supports only one parameter: clear action function. | ||
35 | + }) | ||
36 | + afterAll(function () { | ||
37 | + // Presets a clear action, which is performed after all test cases of the test suite end. | ||
38 | + // This API supports only one parameter: clear action function. | ||
39 | + }) | ||
40 | + it('assertContain',0, function () { | ||
41 | + // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. | ||
42 | + hilog.info(0x0000, 'testTag', '%{public}s', 'it begin'); | ||
43 | + let a = 'abc' | ||
44 | + let b = 'b' | ||
45 | + // Defines a variety of assertion methods, which are used to declare expected boolean conditions. | ||
46 | + expect(a).assertContain(b) | ||
47 | + expect(a).assertEqual(a) | ||
48 | + }) | ||
49 | + }) | ||
50 | +} |
1 | +/* | ||
2 | +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. | ||
3 | +* Licensed under the Apache License, Version 2.0 (the "License"); | ||
4 | +* you may not use this file except in compliance with the License. | ||
5 | +* You may obtain a copy of the License at | ||
6 | +* | ||
7 | +* http://www.apache.org/licenses/LICENSE-2.0 | ||
8 | +* | ||
9 | +* Unless required by applicable law or agreed to in writing, software | ||
10 | +* distributed under the License is distributed on an "AS IS" BASIS, | ||
11 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
12 | +* See the License for the specific language governing permissions and | ||
13 | +* limitations under the License. | ||
14 | +*/ | ||
15 | + | ||
16 | +import abilityTest from './Ability.test' | ||
17 | + | ||
18 | +export default function testsuite() { | ||
19 | + abilityTest() | ||
20 | +} |
1 | +/* | ||
2 | +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. | ||
3 | +* Licensed under the Apache License, Version 2.0 (the "License"); | ||
4 | +* you may not use this file except in compliance with the License. | ||
5 | +* You may obtain a copy of the License at | ||
6 | +* | ||
7 | +* http://www.apache.org/licenses/LICENSE-2.0 | ||
8 | +* | ||
9 | +* Unless required by applicable law or agreed to in writing, software | ||
10 | +* distributed under the License is distributed on an "AS IS" BASIS, | ||
11 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
12 | +* See the License for the specific language governing permissions and | ||
13 | +* limitations under the License. | ||
14 | +*/ | ||
15 | + | ||
16 | +import UIAbility from '@ohos.app.ability.UIAbility'; | ||
17 | +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; | ||
18 | +import hilog from '@ohos.hilog'; | ||
19 | +import { Hypium } from '@ohos/hypium'; | ||
20 | +import testsuite from '../test/List.test'; | ||
21 | +import window from '@ohos.window'; | ||
22 | + | ||
23 | +export default class TestAbility extends UIAbility { | ||
24 | + onCreate(want, launchParam) { | ||
25 | + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); | ||
26 | + hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); | ||
27 | + hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); | ||
28 | + var abilityDelegator: any | ||
29 | + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() | ||
30 | + var abilityDelegatorArguments: any | ||
31 | + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() | ||
32 | + hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); | ||
33 | + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) | ||
34 | + } | ||
35 | + | ||
36 | + onDestroy() { | ||
37 | + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); | ||
38 | + } | ||
39 | + | ||
40 | + onWindowStageCreate(windowStage: window.WindowStage) { | ||
41 | + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); | ||
42 | + windowStage.loadContent('testability/pages/Index', (err, data) => { | ||
43 | + if (err.code) { | ||
44 | + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); | ||
45 | + return; | ||
46 | + } | ||
47 | + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', | ||
48 | + JSON.stringify(data) ?? ''); | ||
49 | + }); | ||
50 | + } | ||
51 | + | ||
52 | + onWindowStageDestroy() { | ||
53 | + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); | ||
54 | + } | ||
55 | + | ||
56 | + onForeground() { | ||
57 | + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); | ||
58 | + } | ||
59 | + | ||
60 | + onBackground() { | ||
61 | + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); | ||
62 | + } | ||
63 | +} |
1 | +/* | ||
2 | +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. | ||
3 | +* Licensed under the Apache License, Version 2.0 (the "License"); | ||
4 | +* you may not use this file except in compliance with the License. | ||
5 | +* You may obtain a copy of the License at | ||
6 | +* | ||
7 | +* http://www.apache.org/licenses/LICENSE-2.0 | ||
8 | +* | ||
9 | +* Unless required by applicable law or agreed to in writing, software | ||
10 | +* distributed under the License is distributed on an "AS IS" BASIS, | ||
11 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
12 | +* See the License for the specific language governing permissions and | ||
13 | +* limitations under the License. | ||
14 | +*/ | ||
15 | + | ||
16 | +import hilog from '@ohos.hilog'; | ||
17 | + | ||
18 | +@Entry | ||
19 | +@Component | ||
20 | +struct Index { | ||
21 | + aboutToAppear() { | ||
22 | + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); | ||
23 | + } | ||
24 | + @State message: string = 'Hello World' | ||
25 | + build() { | ||
26 | + Row() { | ||
27 | + Column() { | ||
28 | + Text(this.message) | ||
29 | + .fontSize(50) | ||
30 | + .fontWeight(FontWeight.Bold) | ||
31 | + Button() { | ||
32 | + Text('next page') | ||
33 | + .fontSize(20) | ||
34 | + .fontWeight(FontWeight.Bold) | ||
35 | + }.type(ButtonType.Capsule) | ||
36 | + .margin({ | ||
37 | + top: 20 | ||
38 | + }) | ||
39 | + .backgroundColor('#0D9FFB') | ||
40 | + .width('35%') | ||
41 | + .height('5%') | ||
42 | + .onClick(()=>{ | ||
43 | + }) | ||
44 | + } | ||
45 | + .width('100%') | ||
46 | + } | ||
47 | + .height('100%') | ||
48 | + } | ||
49 | + } |
1 | +/* | ||
2 | +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. | ||
3 | +* Licensed under the Apache License, Version 2.0 (the "License"); | ||
4 | +* you may not use this file except in compliance with the License. | ||
5 | +* You may obtain a copy of the License at | ||
6 | +* | ||
7 | +* http://www.apache.org/licenses/LICENSE-2.0 | ||
8 | +* | ||
9 | +* Unless required by applicable law or agreed to in writing, software | ||
10 | +* distributed under the License is distributed on an "AS IS" BASIS, | ||
11 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
12 | +* See the License for the specific language governing permissions and | ||
13 | +* limitations under the License. | ||
14 | +*/ | ||
15 | + | ||
16 | +import hilog from '@ohos.hilog'; | ||
17 | +import TestRunner from '@ohos.application.testRunner'; | ||
18 | +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; | ||
19 | + | ||
20 | +var abilityDelegator = undefined | ||
21 | +var abilityDelegatorArguments = undefined | ||
22 | + | ||
23 | +async function onAbilityCreateCallback() { | ||
24 | + hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); | ||
25 | +} | ||
26 | + | ||
27 | +async function addAbilityMonitorCallback(err: any) { | ||
28 | + hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); | ||
29 | +} | ||
30 | + | ||
31 | +export default class OpenHarmonyTestRunner implements TestRunner { | ||
32 | + constructor() { | ||
33 | + } | ||
34 | + | ||
35 | + onPrepare() { | ||
36 | + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); | ||
37 | + } | ||
38 | + | ||
39 | + async onRun() { | ||
40 | + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); | ||
41 | + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() | ||
42 | + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() | ||
43 | + var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' | ||
44 | + let lMonitor = { | ||
45 | + abilityName: testAbilityName, | ||
46 | + onAbilityCreate: onAbilityCreateCallback, | ||
47 | + }; | ||
48 | + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) | ||
49 | + var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName | ||
50 | + var debug = abilityDelegatorArguments.parameters['-D'] | ||
51 | + if (debug == 'true') | ||
52 | + { | ||
53 | + cmd += ' -D' | ||
54 | + } | ||
55 | + hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); | ||
56 | + abilityDelegator.executeShellCommand(cmd, | ||
57 | + (err: any, d: any) => { | ||
58 | + hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); | ||
59 | + hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); | ||
60 | + hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); | ||
61 | + }) | ||
62 | + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); | ||
63 | + } | ||
64 | +} |
example/ohos/entry/src/ohosTest/module.json5
0 → 100644
1 | +/* | ||
2 | +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. | ||
3 | +* Licensed under the Apache License, Version 2.0 (the "License"); | ||
4 | +* you may not use this file except in compliance with the License. | ||
5 | +* You may obtain a copy of the License at | ||
6 | +* | ||
7 | +* http://www.apache.org/licenses/LICENSE-2.0 | ||
8 | +* | ||
9 | +* Unless required by applicable law or agreed to in writing, software | ||
10 | +* distributed under the License is distributed on an "AS IS" BASIS, | ||
11 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
12 | +* See the License for the specific language governing permissions and | ||
13 | +* limitations under the License. | ||
14 | +*/ | ||
15 | + | ||
16 | +{ | ||
17 | + "module": { | ||
18 | + "name": "entry_test", | ||
19 | + "type": "feature", | ||
20 | + "description": "$string:module_test_desc", | ||
21 | + "mainElement": "TestAbility", | ||
22 | + "deviceTypes": [ | ||
23 | + "phone" | ||
24 | + ], | ||
25 | + "deliveryWithInstall": true, | ||
26 | + "installationFree": false, | ||
27 | + "pages": "$profile:test_pages", | ||
28 | + "abilities": [ | ||
29 | + { | ||
30 | + "name": "TestAbility", | ||
31 | + "srcEntry": "./ets/testability/TestAbility.ets", | ||
32 | + "description": "$string:TestAbility_desc", | ||
33 | + "icon": "$media:icon", | ||
34 | + "label": "$string:TestAbility_label", | ||
35 | + "exported": true, | ||
36 | + "startWindowIcon": "$media:icon", | ||
37 | + "startWindowBackground": "$color:start_window_background", | ||
38 | + "skills": [ | ||
39 | + { | ||
40 | + "actions": [ | ||
41 | + "action.system.home" | ||
42 | + ], | ||
43 | + "entities": [ | ||
44 | + "entity.system.home" | ||
45 | + ] | ||
46 | + } | ||
47 | + ] | ||
48 | + } | ||
49 | + ] | ||
50 | + } | ||
51 | +} |

6.63 KB
example/ohos/hvigor/hvigor-config.json5
0 → 100644
1 | +/* | ||
2 | +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. | ||
3 | +* Licensed under the Apache License, Version 2.0 (the "License"); | ||
4 | +* you may not use this file except in compliance with the License. | ||
5 | +* You may obtain a copy of the License at | ||
6 | +* | ||
7 | +* http://www.apache.org/licenses/LICENSE-2.0 | ||
8 | +* | ||
9 | +* Unless required by applicable law or agreed to in writing, software | ||
10 | +* distributed under the License is distributed on an "AS IS" BASIS, | ||
11 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
12 | +* See the License for the specific language governing permissions and | ||
13 | +* limitations under the License. | ||
14 | +*/ | ||
15 | + | ||
16 | +{ | ||
17 | + "modelVersion": "5.0.0", | ||
18 | + "dependencies": { | ||
19 | + } | ||
20 | +} |
example/ohos/hvigorfile.ts
0 → 100644
1 | +/* | ||
2 | +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. | ||
3 | +* Licensed under the Apache License, Version 2.0 (the "License"); | ||
4 | +* you may not use this file except in compliance with the License. | ||
5 | +* You may obtain a copy of the License at | ||
6 | +* | ||
7 | +* http://www.apache.org/licenses/LICENSE-2.0 | ||
8 | +* | ||
9 | +* Unless required by applicable law or agreed to in writing, software | ||
10 | +* distributed under the License is distributed on an "AS IS" BASIS, | ||
11 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
12 | +* See the License for the specific language governing permissions and | ||
13 | +* limitations under the License. | ||
14 | +*/ | ||
15 | + | ||
16 | +import { appTasks } from '@ohos/hvigor-ohos-plugin'; | ||
17 | + | ||
18 | +export default { | ||
19 | + system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ | ||
20 | + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ | ||
21 | +} |
example/ohos/oh-package.json5
0 → 100644
1 | +/* | ||
2 | +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. | ||
3 | +* Licensed under the Apache License, Version 2.0 (the "License"); | ||
4 | +* you may not use this file except in compliance with the License. | ||
5 | +* You may obtain a copy of the License at | ||
6 | +* | ||
7 | +* http://www.apache.org/licenses/LICENSE-2.0 | ||
8 | +* | ||
9 | +* Unless required by applicable law or agreed to in writing, software | ||
10 | +* distributed under the License is distributed on an "AS IS" BASIS, | ||
11 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
12 | +* See the License for the specific language governing permissions and | ||
13 | +* limitations under the License. | ||
14 | +*/ | ||
15 | + | ||
16 | +{ | ||
17 | + "modelVersion": "5.0.0", | ||
18 | + "name": "example", | ||
19 | + "version": "1.0.0", | ||
20 | + "description": "Please describe the basic information.", | ||
21 | + "main": "", | ||
22 | + "author": "", | ||
23 | + "license": "", | ||
24 | + "dependencies": { | ||
25 | + "@ohos/flutter_ohos": "file:./har/flutter.har" | ||
26 | + }, | ||
27 | + "devDependencies": { | ||
28 | + "@ohos/hypium": "1.0.6" | ||
29 | + }, | ||
30 | + "overrides": { | ||
31 | + "@ohos/flutter_ohos": "file:./har/flutter.har" | ||
32 | + } | ||
33 | +} |
example/test/widget_test.dart
deleted
100644 → 0
1 | -// This is a basic Flutter widget test. | ||
2 | -// | ||
3 | -// To perform an interaction with a widget in your test, use the WidgetTester | ||
4 | -// utility in the flutter_test package. For example, you can send tap and scroll | ||
5 | -// gestures. You can also use WidgetTester to find child widgets in the widget | ||
6 | -// tree, read text, and verify that the values of widget properties are correct. | ||
7 | - | ||
8 | -import 'package:flutter/material.dart'; | ||
9 | -import 'package:flutter_test/flutter_test.dart'; | ||
10 | -import 'package:get_demo/main.dart'; | ||
11 | - | ||
12 | -void main() { | ||
13 | - testWidgets('Counter increments smoke test', (WidgetTester tester) async { | ||
14 | - // Build our app and trigger a frame. | ||
15 | - await tester.pumpWidget(const MyApp()); | ||
16 | - | ||
17 | - // Verify that our counter starts at 0. | ||
18 | - expect(find.text('0'), findsOneWidget); | ||
19 | - expect(find.text('1'), findsNothing); | ||
20 | - | ||
21 | - // Tap the '+' icon and trigger a frame. | ||
22 | - await tester.tap(find.byIcon(Icons.add)); | ||
23 | - await tester.pump(); | ||
24 | - | ||
25 | - // Verify that our counter has incremented. | ||
26 | - expect(find.text('0'), findsNothing); | ||
27 | - expect(find.text('1'), findsOneWidget); | ||
28 | - }); | ||
29 | -} |
example_nav2/ohos/.gitignore
0 → 100644
1 | +/node_modules | ||
2 | +/oh_modules | ||
3 | +/local.properties | ||
4 | +/.idea | ||
5 | +**/build | ||
6 | +/.hvigor | ||
7 | +.cxx | ||
8 | +/.clangd | ||
9 | +/.clang-format | ||
10 | +/.clang-tidy | ||
11 | +**/.test | ||
12 | +*.har | ||
13 | +**/BuildProfile.ets | ||
14 | +**/oh-package-lock.json5 | ||
15 | + | ||
16 | +**/src/main/resources/rawfile/flutter_assets/ | ||
17 | +**/libs/arm64-v8a/libapp.so | ||
18 | +**/libs/arm64-v8a/libflutter.so | ||
19 | +**/libs/arm64-v8a/libvmservice_snapshot.so |
example_nav2/ohos/AppScope/app.json5
0 → 100644

6.63 KB
example_nav2/ohos/build-profile.json5
0 → 100644
1 | +/* | ||
2 | +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. | ||
3 | +* Licensed under the Apache License, Version 2.0 (the "License"); | ||
4 | +* you may not use this file except in compliance with the License. | ||
5 | +* You may obtain a copy of the License at | ||
6 | +* | ||
7 | +* http://www.apache.org/licenses/LICENSE-2.0 | ||
8 | +* | ||
9 | +* Unless required by applicable law or agreed to in writing, software | ||
10 | +* distributed under the License is distributed on an "AS IS" BASIS, | ||
11 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
12 | +* See the License for the specific language governing permissions and | ||
13 | +* limitations under the License. | ||
14 | +*/ | ||
15 | + | ||
16 | +{ | ||
17 | + "app": { | ||
18 | + "signingConfigs": [], | ||
19 | + "products": [ | ||
20 | + { | ||
21 | + "name": "default", | ||
22 | + "signingConfig": "default", | ||
23 | + "compatibleSdkVersion": "5.0.0(12)", | ||
24 | + "runtimeOS": "HarmonyOS", | ||
25 | + } | ||
26 | + ] | ||
27 | + }, | ||
28 | + "modules": [ | ||
29 | + { | ||
30 | + "name": "entry", | ||
31 | + "srcPath": "./entry", | ||
32 | + "targets": [ | ||
33 | + { | ||
34 | + "name": "default", | ||
35 | + "applyToProducts": [ | ||
36 | + "default" | ||
37 | + ] | ||
38 | + } | ||
39 | + ] | ||
40 | + } | ||
41 | + ] | ||
42 | +} |
example_nav2/ohos/entry/.gitignore
0 → 100644
example_nav2/ohos/entry/build-profile.json5
0 → 100644
1 | +/* | ||
2 | +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. | ||
3 | +* Licensed under the Apache License, Version 2.0 (the "License"); | ||
4 | +* you may not use this file except in compliance with the License. | ||
5 | +* You may obtain a copy of the License at | ||
6 | +* | ||
7 | +* http://www.apache.org/licenses/LICENSE-2.0 | ||
8 | +* | ||
9 | +* Unless required by applicable law or agreed to in writing, software | ||
10 | +* distributed under the License is distributed on an "AS IS" BASIS, | ||
11 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
12 | +* See the License for the specific language governing permissions and | ||
13 | +* limitations under the License. | ||
14 | +*/ | ||
15 | + | ||
16 | +{ | ||
17 | + "apiType": 'stageMode', | ||
18 | + "buildOption": { | ||
19 | + }, | ||
20 | + "targets": [ | ||
21 | + { | ||
22 | + "name": "default", | ||
23 | + "runtimeOS": "HarmonyOS" | ||
24 | + }, | ||
25 | + { | ||
26 | + "name": "ohosTest", | ||
27 | + } | ||
28 | + ] | ||
29 | +} |
example_nav2/ohos/entry/hvigorfile.ts
0 → 100644
1 | +/* | ||
2 | +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. | ||
3 | +* Licensed under the Apache License, Version 2.0 (the "License"); | ||
4 | +* you may not use this file except in compliance with the License. | ||
5 | +* You may obtain a copy of the License at | ||
6 | +* | ||
7 | +* http://www.apache.org/licenses/LICENSE-2.0 | ||
8 | +* | ||
9 | +* Unless required by applicable law or agreed to in writing, software | ||
10 | +* distributed under the License is distributed on an "AS IS" BASIS, | ||
11 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
12 | +* See the License for the specific language governing permissions and | ||
13 | +* limitations under the License. | ||
14 | +*/ | ||
15 | + | ||
16 | +// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. | ||
17 | +export { hapTasks } from '@ohos/hvigor-ohos-plugin'; |
example_nav2/ohos/entry/oh-package.json5
0 → 100644
1 | +/* | ||
2 | +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. | ||
3 | +* Licensed under the Apache License, Version 2.0 (the "License"); | ||
4 | +* you may not use this file except in compliance with the License. | ||
5 | +* You may obtain a copy of the License at | ||
6 | +* | ||
7 | +* http://www.apache.org/licenses/LICENSE-2.0 | ||
8 | +* | ||
9 | +* Unless required by applicable law or agreed to in writing, software | ||
10 | +* distributed under the License is distributed on an "AS IS" BASIS, | ||
11 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
12 | +* See the License for the specific language governing permissions and | ||
13 | +* limitations under the License. | ||
14 | +*/ | ||
15 | + | ||
16 | +import { FlutterAbility, FlutterEngine } from '@ohos/flutter_ohos'; | ||
17 | +import { GeneratedPluginRegistrant } from '../plugins/GeneratedPluginRegistrant'; | ||
18 | + | ||
19 | +export default class EntryAbility extends FlutterAbility { | ||
20 | + configureFlutterEngine(flutterEngine: FlutterEngine) { | ||
21 | + super.configureFlutterEngine(flutterEngine) | ||
22 | + GeneratedPluginRegistrant.registerWith(flutterEngine) | ||
23 | + } | ||
24 | +} |
1 | +/* | ||
2 | +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. | ||
3 | +* Licensed under the Apache License, Version 2.0 (the "License"); | ||
4 | +* you may not use this file except in compliance with the License. | ||
5 | +* You may obtain a copy of the License at | ||
6 | +* | ||
7 | +* http://www.apache.org/licenses/LICENSE-2.0 | ||
8 | +* | ||
9 | +* Unless required by applicable law or agreed to in writing, software | ||
10 | +* distributed under the License is distributed on an "AS IS" BASIS, | ||
11 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
12 | +* See the License for the specific language governing permissions and | ||
13 | +* limitations under the License. | ||
14 | +*/ | ||
15 | + | ||
16 | +import common from '@ohos.app.ability.common'; | ||
17 | +import { FlutterPage } from '@ohos/flutter_ohos' | ||
18 | + | ||
19 | +let storage = LocalStorage.getShared() | ||
20 | +const EVENT_BACK_PRESS = 'EVENT_BACK_PRESS' | ||
21 | + | ||
22 | +@Entry(storage) | ||
23 | +@Component | ||
24 | +struct Index { | ||
25 | + private context = getContext(this) as common.UIAbilityContext | ||
26 | + @LocalStorageLink('viewId') viewId: string = ""; | ||
27 | + | ||
28 | + build() { | ||
29 | + Column() { | ||
30 | + FlutterPage({ viewId: this.viewId }) | ||
31 | + } | ||
32 | + } | ||
33 | + | ||
34 | + onBackPress(): boolean { | ||
35 | + this.context.eventHub.emit(EVENT_BACK_PRESS) | ||
36 | + return true | ||
37 | + } | ||
38 | +} |
1 | +/* | ||
2 | +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. | ||
3 | +* Licensed under the Apache License, Version 2.0 (the "License"); | ||
4 | +* you may not use this file except in compliance with the License. | ||
5 | +* You may obtain a copy of the License at | ||
6 | +* | ||
7 | +* http://www.apache.org/licenses/LICENSE-2.0 | ||
8 | +* | ||
9 | +* Unless required by applicable law or agreed to in writing, software | ||
10 | +* distributed under the License is distributed on an "AS IS" BASIS, | ||
11 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
12 | +* See the License for the specific language governing permissions and | ||
13 | +* limitations under the License. | ||
14 | +*/ | ||
15 | +{ | ||
16 | + "module": { | ||
17 | + "name": "entry", | ||
18 | + "type": "entry", | ||
19 | + "description": "$string:module_desc", | ||
20 | + "mainElement": "EntryAbility", | ||
21 | + "deviceTypes": [ | ||
22 | + "phone" | ||
23 | + ], | ||
24 | + "deliveryWithInstall": true, | ||
25 | + "installationFree": false, | ||
26 | + "pages": "$profile:main_pages", | ||
27 | + "abilities": [ | ||
28 | + { | ||
29 | + "name": "EntryAbility", | ||
30 | + "srcEntry": "./ets/entryability/EntryAbility.ets", | ||
31 | + "description": "$string:EntryAbility_desc", | ||
32 | + "icon": "$media:icon", | ||
33 | + "label": "$string:EntryAbility_label", | ||
34 | + "startWindowIcon": "$media:icon", | ||
35 | + "startWindowBackground": "$color:start_window_background", | ||
36 | + "exported": true, | ||
37 | + "skills": [ | ||
38 | + { | ||
39 | + "entities": [ | ||
40 | + "entity.system.home" | ||
41 | + ], | ||
42 | + "actions": [ | ||
43 | + "action.system.home" | ||
44 | + ] | ||
45 | + } | ||
46 | + ] | ||
47 | + } | ||
48 | + ], | ||
49 | + "requestPermissions": [ | ||
50 | + {"name" : "ohos.permission.INTERNET"}, | ||
51 | + ] | ||
52 | + } | ||
53 | +} |

6.63 KB
1 | +/* | ||
2 | +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. | ||
3 | +* Licensed under the Apache License, Version 2.0 (the "License"); | ||
4 | +* you may not use this file except in compliance with the License. | ||
5 | +* You may obtain a copy of the License at | ||
6 | +* | ||
7 | +* http://www.apache.org/licenses/LICENSE-2.0 | ||
8 | +* | ||
9 | +* Unless required by applicable law or agreed to in writing, software | ||
10 | +* distributed under the License is distributed on an "AS IS" BASIS, | ||
11 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
12 | +* See the License for the specific language governing permissions and | ||
13 | +* limitations under the License. | ||
14 | +*/ | ||
15 | + | ||
16 | +import hilog from '@ohos.hilog'; | ||
17 | +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' | ||
18 | + | ||
19 | +export default function abilityTest() { | ||
20 | + describe('ActsAbilityTest', function () { | ||
21 | + // Defines a test suite. Two parameters are supported: test suite name and test suite function. | ||
22 | + beforeAll(function () { | ||
23 | + // Presets an action, which is performed only once before all test cases of the test suite start. | ||
24 | + // This API supports only one parameter: preset action function. | ||
25 | + }) | ||
26 | + beforeEach(function () { | ||
27 | + // Presets an action, which is performed before each unit test case starts. | ||
28 | + // The number of execution times is the same as the number of test cases defined by **it**. | ||
29 | + // This API supports only one parameter: preset action function. | ||
30 | + }) | ||
31 | + afterEach(function () { | ||
32 | + // Presets a clear action, which is performed after each unit test case ends. | ||
33 | + // The number of execution times is the same as the number of test cases defined by **it**. | ||
34 | + // This API supports only one parameter: clear action function. | ||
35 | + }) | ||
36 | + afterAll(function () { | ||
37 | + // Presets a clear action, which is performed after all test cases of the test suite end. | ||
38 | + // This API supports only one parameter: clear action function. | ||
39 | + }) | ||
40 | + it('assertContain',0, function () { | ||
41 | + // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. | ||
42 | + hilog.info(0x0000, 'testTag', '%{public}s', 'it begin'); | ||
43 | + let a = 'abc' | ||
44 | + let b = 'b' | ||
45 | + // Defines a variety of assertion methods, which are used to declare expected boolean conditions. | ||
46 | + expect(a).assertContain(b) | ||
47 | + expect(a).assertEqual(a) | ||
48 | + }) | ||
49 | + }) | ||
50 | +} |
1 | +/* | ||
2 | +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. | ||
3 | +* Licensed under the Apache License, Version 2.0 (the "License"); | ||
4 | +* you may not use this file except in compliance with the License. | ||
5 | +* You may obtain a copy of the License at | ||
6 | +* | ||
7 | +* http://www.apache.org/licenses/LICENSE-2.0 | ||
8 | +* | ||
9 | +* Unless required by applicable law or agreed to in writing, software | ||
10 | +* distributed under the License is distributed on an "AS IS" BASIS, | ||
11 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
12 | +* See the License for the specific language governing permissions and | ||
13 | +* limitations under the License. | ||
14 | +*/ | ||
15 | + | ||
16 | +import abilityTest from './Ability.test' | ||
17 | + | ||
18 | +export default function testsuite() { | ||
19 | + abilityTest() | ||
20 | +} |
1 | +/* | ||
2 | +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. | ||
3 | +* Licensed under the Apache License, Version 2.0 (the "License"); | ||
4 | +* you may not use this file except in compliance with the License. | ||
5 | +* You may obtain a copy of the License at | ||
6 | +* | ||
7 | +* http://www.apache.org/licenses/LICENSE-2.0 | ||
8 | +* | ||
9 | +* Unless required by applicable law or agreed to in writing, software | ||
10 | +* distributed under the License is distributed on an "AS IS" BASIS, | ||
11 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
12 | +* See the License for the specific language governing permissions and | ||
13 | +* limitations under the License. | ||
14 | +*/ | ||
15 | + | ||
16 | +import UIAbility from '@ohos.app.ability.UIAbility'; | ||
17 | +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; | ||
18 | +import hilog from '@ohos.hilog'; | ||
19 | +import { Hypium } from '@ohos/hypium'; | ||
20 | +import testsuite from '../test/List.test'; | ||
21 | +import window from '@ohos.window'; | ||
22 | + | ||
23 | +export default class TestAbility extends UIAbility { | ||
24 | + onCreate(want, launchParam) { | ||
25 | + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); | ||
26 | + hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); | ||
27 | + hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); | ||
28 | + var abilityDelegator: any | ||
29 | + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() | ||
30 | + var abilityDelegatorArguments: any | ||
31 | + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() | ||
32 | + hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); | ||
33 | + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) | ||
34 | + } | ||
35 | + | ||
36 | + onDestroy() { | ||
37 | + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); | ||
38 | + } | ||
39 | + | ||
40 | + onWindowStageCreate(windowStage: window.WindowStage) { | ||
41 | + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); | ||
42 | + windowStage.loadContent('testability/pages/Index', (err, data) => { | ||
43 | + if (err.code) { | ||
44 | + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); | ||
45 | + return; | ||
46 | + } | ||
47 | + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', | ||
48 | + JSON.stringify(data) ?? ''); | ||
49 | + }); | ||
50 | + } | ||
51 | + | ||
52 | + onWindowStageDestroy() { | ||
53 | + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); | ||
54 | + } | ||
55 | + | ||
56 | + onForeground() { | ||
57 | + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); | ||
58 | + } | ||
59 | + | ||
60 | + onBackground() { | ||
61 | + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); | ||
62 | + } | ||
63 | +} |
1 | +/* | ||
2 | +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. | ||
3 | +* Licensed under the Apache License, Version 2.0 (the "License"); | ||
4 | +* you may not use this file except in compliance with the License. | ||
5 | +* You may obtain a copy of the License at | ||
6 | +* | ||
7 | +* http://www.apache.org/licenses/LICENSE-2.0 | ||
8 | +* | ||
9 | +* Unless required by applicable law or agreed to in writing, software | ||
10 | +* distributed under the License is distributed on an "AS IS" BASIS, | ||
11 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
12 | +* See the License for the specific language governing permissions and | ||
13 | +* limitations under the License. | ||
14 | +*/ | ||
15 | + | ||
16 | +import hilog from '@ohos.hilog'; | ||
17 | + | ||
18 | +@Entry | ||
19 | +@Component | ||
20 | +struct Index { | ||
21 | + aboutToAppear() { | ||
22 | + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); | ||
23 | + } | ||
24 | + @State message: string = 'Hello World' | ||
25 | + build() { | ||
26 | + Row() { | ||
27 | + Column() { | ||
28 | + Text(this.message) | ||
29 | + .fontSize(50) | ||
30 | + .fontWeight(FontWeight.Bold) | ||
31 | + Button() { | ||
32 | + Text('next page') | ||
33 | + .fontSize(20) | ||
34 | + .fontWeight(FontWeight.Bold) | ||
35 | + }.type(ButtonType.Capsule) | ||
36 | + .margin({ | ||
37 | + top: 20 | ||
38 | + }) | ||
39 | + .backgroundColor('#0D9FFB') | ||
40 | + .width('35%') | ||
41 | + .height('5%') | ||
42 | + .onClick(()=>{ | ||
43 | + }) | ||
44 | + } | ||
45 | + .width('100%') | ||
46 | + } | ||
47 | + .height('100%') | ||
48 | + } | ||
49 | + } |
1 | +/* | ||
2 | +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. | ||
3 | +* Licensed under the Apache License, Version 2.0 (the "License"); | ||
4 | +* you may not use this file except in compliance with the License. | ||
5 | +* You may obtain a copy of the License at | ||
6 | +* | ||
7 | +* http://www.apache.org/licenses/LICENSE-2.0 | ||
8 | +* | ||
9 | +* Unless required by applicable law or agreed to in writing, software | ||
10 | +* distributed under the License is distributed on an "AS IS" BASIS, | ||
11 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
12 | +* See the License for the specific language governing permissions and | ||
13 | +* limitations under the License. | ||
14 | +*/ | ||
15 | + | ||
16 | +import hilog from '@ohos.hilog'; | ||
17 | +import TestRunner from '@ohos.application.testRunner'; | ||
18 | +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; | ||
19 | + | ||
20 | +var abilityDelegator = undefined | ||
21 | +var abilityDelegatorArguments = undefined | ||
22 | + | ||
23 | +async function onAbilityCreateCallback() { | ||
24 | + hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); | ||
25 | +} | ||
26 | + | ||
27 | +async function addAbilityMonitorCallback(err: any) { | ||
28 | + hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); | ||
29 | +} | ||
30 | + | ||
31 | +export default class OpenHarmonyTestRunner implements TestRunner { | ||
32 | + constructor() { | ||
33 | + } | ||
34 | + | ||
35 | + onPrepare() { | ||
36 | + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); | ||
37 | + } | ||
38 | + | ||
39 | + async onRun() { | ||
40 | + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); | ||
41 | + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() | ||
42 | + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() | ||
43 | + var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' | ||
44 | + let lMonitor = { | ||
45 | + abilityName: testAbilityName, | ||
46 | + onAbilityCreate: onAbilityCreateCallback, | ||
47 | + }; | ||
48 | + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) | ||
49 | + var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName | ||
50 | + var debug = abilityDelegatorArguments.parameters['-D'] | ||
51 | + if (debug == 'true') | ||
52 | + { | ||
53 | + cmd += ' -D' | ||
54 | + } | ||
55 | + hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); | ||
56 | + abilityDelegator.executeShellCommand(cmd, | ||
57 | + (err: any, d: any) => { | ||
58 | + hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); | ||
59 | + hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); | ||
60 | + hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); | ||
61 | + }) | ||
62 | + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); | ||
63 | + } | ||
64 | +} |
1 | +/* | ||
2 | +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. | ||
3 | +* Licensed under the Apache License, Version 2.0 (the "License"); | ||
4 | +* you may not use this file except in compliance with the License. | ||
5 | +* You may obtain a copy of the License at | ||
6 | +* | ||
7 | +* http://www.apache.org/licenses/LICENSE-2.0 | ||
8 | +* | ||
9 | +* Unless required by applicable law or agreed to in writing, software | ||
10 | +* distributed under the License is distributed on an "AS IS" BASIS, | ||
11 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
12 | +* See the License for the specific language governing permissions and | ||
13 | +* limitations under the License. | ||
14 | +*/ | ||
15 | + | ||
16 | +{ | ||
17 | + "module": { | ||
18 | + "name": "entry_test", | ||
19 | + "type": "feature", | ||
20 | + "description": "$string:module_test_desc", | ||
21 | + "mainElement": "TestAbility", | ||
22 | + "deviceTypes": [ | ||
23 | + "phone" | ||
24 | + ], | ||
25 | + "deliveryWithInstall": true, | ||
26 | + "installationFree": false, | ||
27 | + "pages": "$profile:test_pages", | ||
28 | + "abilities": [ | ||
29 | + { | ||
30 | + "name": "TestAbility", | ||
31 | + "srcEntry": "./ets/testability/TestAbility.ets", | ||
32 | + "description": "$string:TestAbility_desc", | ||
33 | + "icon": "$media:icon", | ||
34 | + "label": "$string:TestAbility_label", | ||
35 | + "exported": true, | ||
36 | + "startWindowIcon": "$media:icon", | ||
37 | + "startWindowBackground": "$color:start_window_background", | ||
38 | + "skills": [ | ||
39 | + { | ||
40 | + "actions": [ | ||
41 | + "action.system.home" | ||
42 | + ], | ||
43 | + "entities": [ | ||
44 | + "entity.system.home" | ||
45 | + ] | ||
46 | + } | ||
47 | + ] | ||
48 | + } | ||
49 | + ] | ||
50 | + } | ||
51 | +} |

6.63 KB
example_nav2/ohos/hvigor/hvigor-config.json5
0 → 100644
1 | +/* | ||
2 | +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. | ||
3 | +* Licensed under the Apache License, Version 2.0 (the "License"); | ||
4 | +* you may not use this file except in compliance with the License. | ||
5 | +* You may obtain a copy of the License at | ||
6 | +* | ||
7 | +* http://www.apache.org/licenses/LICENSE-2.0 | ||
8 | +* | ||
9 | +* Unless required by applicable law or agreed to in writing, software | ||
10 | +* distributed under the License is distributed on an "AS IS" BASIS, | ||
11 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
12 | +* See the License for the specific language governing permissions and | ||
13 | +* limitations under the License. | ||
14 | +*/ | ||
15 | + | ||
16 | +{ | ||
17 | + "modelVersion": "5.0.0", | ||
18 | + "dependencies": { | ||
19 | + } | ||
20 | +} |
example_nav2/ohos/hvigorfile.ts
0 → 100644
1 | +/* | ||
2 | +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. | ||
3 | +* Licensed under the Apache License, Version 2.0 (the "License"); | ||
4 | +* you may not use this file except in compliance with the License. | ||
5 | +* You may obtain a copy of the License at | ||
6 | +* | ||
7 | +* http://www.apache.org/licenses/LICENSE-2.0 | ||
8 | +* | ||
9 | +* Unless required by applicable law or agreed to in writing, software | ||
10 | +* distributed under the License is distributed on an "AS IS" BASIS, | ||
11 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
12 | +* See the License for the specific language governing permissions and | ||
13 | +* limitations under the License. | ||
14 | +*/ | ||
15 | + | ||
16 | +import { appTasks } from '@ohos/hvigor-ohos-plugin'; | ||
17 | + | ||
18 | +export default { | ||
19 | + system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ | ||
20 | + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ | ||
21 | +} |
example_nav2/ohos/oh-package.json5
0 → 100644
1 | +/* | ||
2 | +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. | ||
3 | +* Licensed under the Apache License, Version 2.0 (the "License"); | ||
4 | +* you may not use this file except in compliance with the License. | ||
5 | +* You may obtain a copy of the License at | ||
6 | +* | ||
7 | +* http://www.apache.org/licenses/LICENSE-2.0 | ||
8 | +* | ||
9 | +* Unless required by applicable law or agreed to in writing, software | ||
10 | +* distributed under the License is distributed on an "AS IS" BASIS, | ||
11 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
12 | +* See the License for the specific language governing permissions and | ||
13 | +* limitations under the License. | ||
14 | +*/ | ||
15 | + | ||
16 | +{ | ||
17 | + "modelVersion": "5.0.0", | ||
18 | + "name": "example", | ||
19 | + "version": "1.0.0", | ||
20 | + "description": "Please describe the basic information.", | ||
21 | + "main": "", | ||
22 | + "author": "", | ||
23 | + "license": "", | ||
24 | + "dependencies": { | ||
25 | + "@ohos/flutter_ohos": "file:./har/flutter.har" | ||
26 | + }, | ||
27 | + "devDependencies": { | ||
28 | + "@ohos/hypium": "1.0.6" | ||
29 | + }, | ||
30 | + "overrides": { | ||
31 | + "@ohos/flutter_ohos": "file:./har/flutter.har" | ||
32 | + } | ||
33 | +} |
@@ -14,9 +14,12 @@ class GetPlatform { | @@ -14,9 +14,12 @@ class GetPlatform { | ||
14 | 14 | ||
15 | static bool get isIOS => GeneralPlatform.isIOS; | 15 | static bool get isIOS => GeneralPlatform.isIOS; |
16 | 16 | ||
17 | + static bool get isOhos => GeneralPlatform.isOhos; | ||
18 | + | ||
17 | static bool get isFuchsia => GeneralPlatform.isFuchsia; | 19 | static bool get isFuchsia => GeneralPlatform.isFuchsia; |
18 | 20 | ||
19 | - static bool get isMobile => GetPlatform.isIOS || GetPlatform.isAndroid; | 21 | + static bool get isMobile => |
22 | + GetPlatform.isIOS || GetPlatform.isAndroid || GetPlatform.isOhos; | ||
20 | 23 | ||
21 | static bool get isDesktop => | 24 | static bool get isDesktop => |
22 | GetPlatform.isMacOS || GetPlatform.isWindows || GetPlatform.isLinux; | 25 | GetPlatform.isMacOS || GetPlatform.isWindows || GetPlatform.isLinux; |
@@ -14,6 +14,8 @@ class GeneralPlatform { | @@ -14,6 +14,8 @@ class GeneralPlatform { | ||
14 | 14 | ||
15 | static bool get isIOS => Platform.isIOS; | 15 | static bool get isIOS => Platform.isIOS; |
16 | 16 | ||
17 | + static bool get isOhos => Platform.operatingSystem == 'ohos'; | ||
18 | + | ||
17 | static bool get isFuchsia => Platform.isFuchsia; | 19 | static bool get isFuchsia => Platform.isFuchsia; |
18 | 20 | ||
19 | static bool get isDesktop => | 21 | static bool get isDesktop => |
@@ -29,6 +29,8 @@ class GeneralPlatform { | @@ -29,6 +29,8 @@ class GeneralPlatform { | ||
29 | (_navigator.platform == 'MacIntel' && _navigator.maxTouchPoints! > 1); | 29 | (_navigator.platform == 'MacIntel' && _navigator.maxTouchPoints! > 1); |
30 | } | 30 | } |
31 | 31 | ||
32 | + static bool get isOhos => _navigator.appVersion.contains('ArkWeb'); | ||
33 | + | ||
32 | static bool get isFuchsia => false; | 34 | static bool get isFuchsia => false; |
33 | 35 | ||
34 | static bool get isDesktop => isMacOS || isWindows || isLinux; | 36 | static bool get isDesktop => isMacOS || isWindows || isLinux; |
@@ -7,6 +7,7 @@ void main() { | @@ -7,6 +7,7 @@ void main() { | ||
7 | test('Platform test', () { | 7 | test('Platform test', () { |
8 | expect(GetPlatform.isAndroid, Platform.isAndroid); | 8 | expect(GetPlatform.isAndroid, Platform.isAndroid); |
9 | expect(GetPlatform.isIOS, Platform.isIOS); | 9 | expect(GetPlatform.isIOS, Platform.isIOS); |
10 | + expect(GetPlatform.isOhos, Platform.operatingSystem == 'ohos'); | ||
10 | expect(GetPlatform.isFuchsia, Platform.isFuchsia); | 11 | expect(GetPlatform.isFuchsia, Platform.isFuchsia); |
11 | expect(GetPlatform.isLinux, Platform.isLinux); | 12 | expect(GetPlatform.isLinux, Platform.isLinux); |
12 | expect(GetPlatform.isMacOS, Platform.isMacOS); | 13 | expect(GetPlatform.isMacOS, Platform.isMacOS); |
@@ -7,6 +7,7 @@ void main() { | @@ -7,6 +7,7 @@ void main() { | ||
7 | test('Platform test', () { | 7 | test('Platform test', () { |
8 | expect(GetPlatform.isAndroid, Platform.isAndroid); | 8 | expect(GetPlatform.isAndroid, Platform.isAndroid); |
9 | expect(GetPlatform.isIOS, Platform.isIOS); | 9 | expect(GetPlatform.isIOS, Platform.isIOS); |
10 | + expect(GetPlatform.isOhos, Platform.operatingSystem == 'ohos'); | ||
10 | expect(GetPlatform.isFuchsia, Platform.isFuchsia); | 11 | expect(GetPlatform.isFuchsia, Platform.isFuchsia); |
11 | expect(GetPlatform.isLinux, Platform.isLinux); | 12 | expect(GetPlatform.isLinux, Platform.isLinux); |
12 | expect(GetPlatform.isMacOS, Platform.isMacOS); | 13 | expect(GetPlatform.isMacOS, Platform.isMacOS); |
-
Please register or login to post a comment