diff --git a/bundlemanager/bundle_standard/bundlemanager/BUILD.gn b/bundlemanager/bundle_standard/bundlemanager/BUILD.gn index 0e8839ec38cbd68046e3e470e40095a61186d918..64a67fc29ad17b8cb3fbf03d28f03dea6578ecc1 100644 --- a/bundlemanager/bundle_standard/bundlemanager/BUILD.gn +++ b/bundlemanager/bundle_standard/bundlemanager/BUILD.gn @@ -28,6 +28,7 @@ group("bundlemanager") { "actsbmsstageetstest:ActBmsStageEtsTest", "actsbundlemanageretstest:ActsBundleManagerEtsTest", "actsbundlemanagertest:ActsBundleManagerTest", + "actsbundlenativetest:ActsBmsNapiEtsTest", "sceneProject/bmsaccesstokenfive:bmsAccessTokenTest5", "sceneProject/bmsaccesstokenfour:bmsAccessTokenTest4", "sceneProject/bmsaccesstokenone:bmsAccessTokenTest1", diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/BUILD.gn b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..e8b2e556bce02ffd392c82becada89af2c41df31 --- /dev/null +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/BUILD.gn @@ -0,0 +1,38 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/ohos.gni") +import("//test/xts/tools/build/suite.gni") +ohos_js_hap_suite("ActsBmsNapiEtsTest") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":ace_third_ets_assets", + ":ace_third_ets_resources", + ":ace_third_ets_test_assets", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsBmsNapiEtsTest" + shared_libraries = [ "./entry/src/main/cpp:teststring" ] +} + +ohos_js_assets("ace_third_ets_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_js_assets("ace_third_ets_test_assets") { + source_dir = "./entry/src/main/ets/TestAbility" +} +ohos_resources("ace_third_ets_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/Test.json b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/Test.json new file mode 100755 index 0000000000000000000000000000000000000000..41e4c8c5529860f3b28c1dee47f996e1e7a1c484 --- /dev/null +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/Test.json @@ -0,0 +1,19 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.example.nativetest", + "package-name": "com.example.nativetest", + "shell-timeout": "600000" + }, + "kits": [ + { + "test-file-name": [ + "ActsBmsNapiEtsTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/config.json new file mode 100755 index 0000000000000000000000000000000000000000..839b465d966ad54430e16a898d29834a2721850f --- /dev/null +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/config.json @@ -0,0 +1,99 @@ +{ + "app": { + "bundleName": "com.example.nativetest", + "vendor": "example", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 8 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.nativetest", + "name": ".MyApplication", + "mainAbility": "com.example.nativetest.MainAbility", + + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "formsEnabled": false, + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + }, + { + "orientation": "unspecified", + "visible": true, + "srcPath": "TestAbility", + "name": ".TestAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:TestAbility_desc", + "formsEnabled": false, + "label": "$string:TestAbility_label", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + }, + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".TestAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/cpp/BUILD.gn b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/cpp/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..cc0b4b50750dd494680200a75b81194602689eb0 --- /dev/null +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/cpp/BUILD.gn @@ -0,0 +1,50 @@ +# Copyright (C) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/config/ohos/config.gni") +import("//build/ohos.gni") +import("//foundation/arkui/napi/napi.gni") + +config("config") { + visibility = [ ":*" ] + + cflags = [ + "-Wall", + "-Werror", + "-g3", + "-Wunused-variable", + ] +} + +config("public_config") { +} + +ohos_shared_library("teststring") { + sources = [ "./teststring.cpp" ] + if (!(product_name == "m40")) { + if (target_cpu == "arm") { + libs = [ "${clang_base_path}/../libcxx-ndk/lib/arm-linux-ohos/c++/libc++_shared.so" ] + } else if (target_cpu == "arm64") { + libs = [ "${clang_base_path}/../libcxx-ndk/lib/aarch64-linux-ohos/c++/libc++_shared.so" ] + } else { + libs = [] + } + } + + include_dirs = [ "//test/xts/acts/arkui/ace_napi_test/entry/src/main/cpp" ] + configs = [ ":config" ] + + deps = [ "//foundation/arkui/napi:ace_napi" ] + + output_extension = "so" +} diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/cpp/CMakeLists.txt b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/cpp/CMakeLists.txt new file mode 100755 index 0000000000000000000000000000000000000000..229b64544864eb11d3767d9926cd1360d6f2cb9e --- /dev/null +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/cpp/CMakeLists.txt @@ -0,0 +1,11 @@ +# the minimum version of CMake. +cmake_minimum_required(VERSION 3.4.1) +project(XComponent) + +set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}) + +include_directories(${NATIVERENDER_ROOT_PATH} + ${NATIVERENDER_ROOT_PATH}/include) + +add_library(teststring SHARED teststring.cpp) +target_link_libraries(teststring PUBLIC libace_nap i.z.so libc++.a) \ No newline at end of file diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/cpp/teststring.cpp b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/cpp/teststring.cpp new file mode 100755 index 0000000000000000000000000000000000000000..6042c5bfb9f17e3830614395613aa5a932439e0b --- /dev/null +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/cpp/teststring.cpp @@ -0,0 +1,53 @@ +#include "napi/native_api.h" + +static napi_value Add(napi_env env, napi_callback_info info) +{ + size_t argc = 2; + napi_value args[2] = {nullptr}; + + napi_get_cb_info(env, info, &argc, args , nullptr, nullptr); + + napi_valuetype valuetype0; + napi_typeof(env, args[0], &valuetype0); + + napi_valuetype valuetype1; + napi_typeof(env, args[1], &valuetype1); + + double value0; + napi_get_value_double(env, args[0], &value0); + + double value1; + napi_get_value_double(env, args[1], &value1); + + napi_value sum; + napi_create_double(env, value0 + value1, &sum); + + return sum; + +} + +EXTERN_C_START +static napi_value Init(napi_env env, napi_value exports) +{ + napi_property_descriptor desc[] = { + { "add", nullptr, Add, nullptr, nullptr, nullptr, napi_default, nullptr } + }; + napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc); + return exports; +} +EXTERN_C_END + +static napi_module demoModule = { + .nm_version =1, + .nm_flags = 0, + .nm_filename = nullptr, + .nm_register_func = Init, + .nm_modname = "libhello", + .nm_priv = ((void*)0), + .reserved = { 0 }, +}; + +extern "C" __attribute__((constructor)) void RegisterHelloModule(void) +{ + napi_module_register(&demoModule); +} diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/cpp/types/libentry/index.d.ts b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/cpp/types/libentry/index.d.ts new file mode 100755 index 0000000000000000000000000000000000000000..e44f3615a4767c36b4fdc841b781af96bf1971a8 --- /dev/null +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/cpp/types/libentry/index.d.ts @@ -0,0 +1 @@ +export const add: (a: number, b: number) => number; \ No newline at end of file diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/cpp/types/libentry/package.json b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/cpp/types/libentry/package.json new file mode 100755 index 0000000000000000000000000000000000000000..daa57a3a6e010e2259cc16a4414e8df8414d3305 --- /dev/null +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/cpp/types/libentry/package.json @@ -0,0 +1,4 @@ +{ + "name": "libteststring.so", + "types": "./index.d.ts" +} \ No newline at end of file diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/ets/MainAbility/app.ets b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/ets/MainAbility/app.ets new file mode 100755 index 0000000000000000000000000000000000000000..6b29cb8048a4edbca5f8fbc6197c0fb227c00f64 --- /dev/null +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/ets/MainAbility/app.ets @@ -0,0 +1,33 @@ +// @ts-nocheck +/** + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from 'hypium/index' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('Application onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/ets/MainAbility/pages/index.ets b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100755 index 0000000000000000000000000000000000000000..987f3a954fdecfaede4540d18cb97a080cb2a826 --- /dev/null +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,37 @@ +// @ts-nocheck +/** + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct MyComponent { + aboutToAppear() { + } + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Text('ACE ETS TEST') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} + diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/ets/TestAbility/app.ets b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/ets/TestAbility/app.ets new file mode 100755 index 0000000000000000000000000000000000000000..6b29cb8048a4edbca5f8fbc6197c0fb227c00f64 --- /dev/null +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/ets/TestAbility/app.ets @@ -0,0 +1,33 @@ +// @ts-nocheck +/** + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from 'hypium/index' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('Application onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/ets/TestAbility/pages/index.ets b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/ets/TestAbility/pages/index.ets new file mode 100755 index 0000000000000000000000000000000000000000..0d0efe0a85177331cccf9524a7cd747c966dcbe5 --- /dev/null +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/ets/TestAbility/pages/index.ets @@ -0,0 +1,50 @@ +// @ts-nocheck +/** + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import router from '@system.router'; + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('TestAbility index aboutToAppear') + } + + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100755 index 0000000000000000000000000000000000000000..07cb0b784984c6c4cc6d911c3c82643bff9df263 --- /dev/null +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,78 @@ +// @ts-nocheck +/** + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s itName', + '-s level', '-s testType', '-s size', '-s timeout', + '-s package' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams += ' ' + key + ' ' + parameters[key] + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log('onAbilityCreateCallback'); +} + +async function addAbilityMonitorCallback(err: any) { + console.info('addAbilityMonitorCallback : ' + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info('OpenHarmonyTestRunner OnPrepare') + } + + onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.MainAbility' + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun call abilityDelegator.getAppContext') + var context = abilityDelegator.getAppContext() + console.info('getAppContext : ' + JSON.stringify(context)) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/ets/test/List.test.ets b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/ets/test/List.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..43dca6e7d2672a3e8733b52002b4e22020060609 --- /dev/null +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import napiStringTest from './NativeApiStringTest'; + +export default function testsuite() { + napiStringTest() +} \ No newline at end of file diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/ets/test/NativeApiStringTest.ets b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/ets/test/NativeApiStringTest.ets new file mode 100755 index 0000000000000000000000000000000000000000..27873dc9faa08e02205caeb48f9ee33048614a5a --- /dev/null +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/ets/test/NativeApiStringTest.ets @@ -0,0 +1,57 @@ +// @ts-nocheck +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" + +import testString from 'libteststring.so' + + +export default function nativeApiStringJsunit() { + + describe('napiStringTest', function () { + const empty = ''; + var value; + + async function sleep(time) { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve() + }, time) + }).then(() => { + console.info( `sleep ${time} over...`) + }) + } + + /** + * run after testcase + */ + afterEach(async function () { + console.info('[napiStringTest] after each called') + value == ''; + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0100 + * @tc.name napiStringTest001 + * @tc.desc aceNapiEtsTest + */ + it('napiStringTest001', 0, async function (done) { + console.info("Test NAPI 2 + 3 = " + testString.Add(2, 3)); + done(); + }); + + }) +} diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/resources/base/element/string.json b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/resources/base/element/string.json new file mode 100755 index 0000000000000000000000000000000000000000..498677efbde065c36668727190d3613cbf278bfc --- /dev/null +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,20 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + }, + { + "name": "TestAbility_desc", + "value": "description" + }, + { + "name": "TestAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/resources/base/media/icon.png b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/resources/base/media/icon.png new file mode 100755 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/resources/base/media/icon.png differ diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/signature/openharmony_sx.p7b b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/signature/openharmony_sx.p7b new file mode 100755 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/signature/openharmony_sx.p7b differ