Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
a23c2cf6
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
a23c2cf6
编写于
6月 25, 2022
作者:
O
openharmony_ci
提交者:
Gitee
6月 25, 2022
浏览文件
操作
浏览文件
下载
差异文件
!3776 新增ndk测试套
Merge pull request !3776 from zj/master
上级
9dae5543
82d93bc9
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
708 addition
and
0 deletion
+708
-0
arkui/BUILD.gn
arkui/BUILD.gn
+1
-0
arkui/ace_napi_test/BUILD.gn
arkui/ace_napi_test/BUILD.gn
+38
-0
arkui/ace_napi_test/Test.json
arkui/ace_napi_test/Test.json
+19
-0
arkui/ace_napi_test/entry/src/main/config.json
arkui/ace_napi_test/entry/src/main/config.json
+99
-0
arkui/ace_napi_test/entry/src/main/cpp/BUILD.gn
arkui/ace_napi_test/entry/src/main/cpp/BUILD.gn
+47
-0
arkui/ace_napi_test/entry/src/main/cpp/common/native_common.h
...i/ace_napi_test/entry/src/main/cpp/common/native_common.h
+101
-0
arkui/ace_napi_test/entry/src/main/cpp/napi/test_string.cpp
arkui/ace_napi_test/entry/src/main/cpp/napi/test_string.cpp
+73
-0
arkui/ace_napi_test/entry/src/main/ets/MainAbility/app.ets
arkui/ace_napi_test/entry/src/main/ets/MainAbility/app.ets
+33
-0
arkui/ace_napi_test/entry/src/main/ets/MainAbility/pages/index.ets
..._napi_test/entry/src/main/ets/MainAbility/pages/index.ets
+37
-0
arkui/ace_napi_test/entry/src/main/ets/TestAbility/app.ets
arkui/ace_napi_test/entry/src/main/ets/TestAbility/app.ets
+33
-0
arkui/ace_napi_test/entry/src/main/ets/TestAbility/pages/index.ets
..._napi_test/entry/src/main/ets/TestAbility/pages/index.ets
+50
-0
arkui/ace_napi_test/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
...st/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
+78
-0
arkui/ace_napi_test/entry/src/main/ets/test/List.test.ets
arkui/ace_napi_test/entry/src/main/ets/test/List.test.ets
+19
-0
arkui/ace_napi_test/entry/src/main/ets/test/NativeApiStringTest.ets
...napi_test/entry/src/main/ets/test/NativeApiStringTest.ets
+60
-0
arkui/ace_napi_test/entry/src/main/resources/base/element/string.json
...pi_test/entry/src/main/resources/base/element/string.json
+20
-0
arkui/ace_napi_test/entry/src/main/resources/base/media/icon.png
...ce_napi_test/entry/src/main/resources/base/media/icon.png
+0
-0
arkui/ace_napi_test/signature/openharmony_sx.p7b
arkui/ace_napi_test/signature/openharmony_sx.p7b
+0
-0
未找到文件。
arkui/BUILD.gn
浏览文件 @
a23c2cf6
...
...
@@ -22,6 +22,7 @@ group("arkui") {
"ace_ets_standard:ActsAceEtsStTest",
"ace_ets_test:ActsAceEtsTest",
"ace_ets_third_test:ActsAceEtsThirdTest",
"ace_napi_test:ActsAceNapiEtsTest",
"ace_standard:ace_standard_test",
"ace_standard_video:ace_standard_video_test",
]
...
...
arkui/ace_napi_test/BUILD.gn
0 → 100644
浏览文件 @
a23c2cf6
# 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("ActsAceNapiEtsTest") {
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 = "ActsAceNapiEtsTest"
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"
}
arkui/ace_napi_test/Test.json
0 → 100644
浏览文件 @
a23c2cf6
{
"description"
:
"Configuration for hjunit demo Tests"
,
"driver"
:
{
"type"
:
"OHJSUnitTest"
,
"test-timeout"
:
"600000"
,
"bundle-name"
:
"com.acts.ace.napitest"
,
"package-name"
:
"com.acts.ace.napitest"
,
"shell-timeout"
:
"600000"
},
"kits"
:
[
{
"test-file-name"
:
[
"ActsAceNapiEtsTest.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
}
]
}
arkui/ace_napi_test/entry/src/main/config.json
0 → 100644
浏览文件 @
a23c2cf6
{
"app"
:
{
"bundleName"
:
"com.acts.ace.napitest"
,
"vendor"
:
"open"
,
"version"
:
{
"code"
:
1000000
,
"name"
:
"1.0.0"
},
"apiVersion"
:
{
"compatible"
:
7
,
"releaseType"
:
"Release"
,
"target"
:
8
}
},
"deviceConfig"
:
{},
"module"
:
{
"package"
:
"com.acts.ace.napitest"
,
"name"
:
".MyApplication"
,
"mainAbility"
:
"com.acts.ace.napitest.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
arkui/ace_napi_test/entry/src/main/cpp/BUILD.gn
0 → 100644
浏览文件 @
a23c2cf6
# 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 = [ "./napi/test_string.cpp" ]
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"
}
arkui/ace_napi_test/entry/src/main/cpp/common/native_common.h
0 → 100644
浏览文件 @
a23c2cf6
/*
* 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.
*/
#ifndef FOUNDATION_ACE_NAPI_INTERFACES_KITS_NAPI_NATIVE_COMMON_H
#define FOUNDATION_ACE_NAPI_INTERFACES_KITS_NAPI_NATIVE_COMMON_H
#define DEPRECATED __attribute__((__deprecated__))
#define NAPI_VERSION 8
#define NAPI_RETVAL_NOTHING
#define GET_AND_THROW_LAST_ERROR(env) \
do { \
const napi_extended_error_info* errorInfo = nullptr; \
napi_get_last_error_info((env), &errorInfo); \
bool isPending = false; \
napi_is_exception_pending((env), &isPending); \
if (!isPending && errorInfo != nullptr) { \
const char* errorMessage = \
errorInfo->error_message != nullptr ? errorInfo->error_message : "empty error message"; \
napi_throw_error((env), nullptr, errorMessage); \
} \
} while (0)
#define NAPI_ASSERT_BASE(env, assertion, message, retVal) \
do { \
if (!(assertion)) { \
napi_throw_error((env), nullptr, "assertion (" #assertion ") failed: " message); \
return retVal; \
} \
} while (0)
#define NAPI_ASSERT(env, assertion, message) NAPI_ASSERT_BASE(env, assertion, message, nullptr)
#define NAPI_ASSERT_RETURN_VOID(env, assertion, message) NAPI_ASSERT_BASE(env, assertion, message, NAPI_RETVAL_NOTHING)
#define NAPI_CALL_BASE(env, theCall, retVal) \
do { \
if ((theCall) != napi_ok) { \
GET_AND_THROW_LAST_ERROR((env)); \
return retVal; \
} \
} while (0)
#define NAPI_CALL(env, theCall) NAPI_CALL_BASE(env, theCall, nullptr)
#define NAPI_CALL_RETURN_VOID(env, theCall) NAPI_CALL_BASE(env, theCall, NAPI_RETVAL_NOTHING)
#define DECLARE_NAPI_PROPERTY(name, val) \
{ \
(name), nullptr, nullptr, nullptr, nullptr, val, napi_default, nullptr \
}
#define DECLARE_NAPI_STATIC_PROPERTY(name, val) \
{ \
(name), nullptr, nullptr, nullptr, nullptr, val, napi_static, nullptr \
}
#define DECLARE_NAPI_FUNCTION(name, func) \
{ \
(name), nullptr, (func), nullptr, nullptr, nullptr, napi_default, nullptr \
}
#define DECLARE_NAPI_FUNCTION_WITH_DATA(name, func, data) \
{ \
(name), nullptr, (func), nullptr, nullptr, nullptr, napi_default, data \
}
#define DECLARE_NAPI_STATIC_FUNCTION(name, func) \
{ \
(name), nullptr, (func), nullptr, nullptr, nullptr, napi_static, nullptr \
}
#define DECLARE_NAPI_GETTER(name, getter) \
{ \
(name), nullptr, nullptr, (getter), nullptr, nullptr, napi_default, nullptr \
}
#define DECLARE_NAPI_SETTER(name, setter) \
{ \
(name), nullptr, nullptr, nullptr, (setter), nullptr, napi_default, nullptr \
}
#define DECLARE_NAPI_GETTER_SETTER(name, getter, setter) \
{ \
(name), nullptr, nullptr, (getter), (setter), nullptr, napi_default, nullptr \
}
#endif
/* FOUNDATION_ACE_NAPI_INTERFACES_KITS_NAPI_NATIVE_COMMON_H */
arkui/ace_napi_test/entry/src/main/cpp/napi/test_string.cpp
0 → 100644
浏览文件 @
a23c2cf6
/*
* 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.
*/
#include "common/native_common.h"
#include "napi/native_api.h"
#include <cstdint>
#include <string>
#include <cstdio>
#include <vector>
static
napi_value
TestLatin1
(
napi_env
env
,
napi_callback_info
info
)
{
size_t
argc
=
1
;
napi_value
args
[
1
];
NAPI_CALL
(
env
,
napi_get_cb_info
(
env
,
info
,
&
argc
,
args
,
NULL
,
NULL
));
NAPI_ASSERT
(
env
,
argc
>=
1
,
"Wrong number of arguments"
);
napi_valuetype
valuetype
;
NAPI_CALL
(
env
,
napi_typeof
(
env
,
args
[
0
],
&
valuetype
));
NAPI_ASSERT
(
env
,
valuetype
==
napi_string
,
"Wrong type of argment. Expects a string."
);
char
buffer
[
128
];
size_t
buffer_size
=
128
;
size_t
copied
;
NAPI_CALL
(
env
,
napi_get_value_string_latin1
(
env
,
args
[
0
],
buffer
,
buffer_size
,
&
copied
));
napi_value
output
;
NAPI_CALL
(
env
,
napi_create_string_latin1
(
env
,
buffer
,
copied
,
&
output
));
return
output
;
}
EXTERN_C_START
static
napi_value
Init
(
napi_env
env
,
napi_value
exports
)
{
napi_property_descriptor
properties
[]
=
{
DECLARE_NAPI_FUNCTION
(
"TestLatin1"
,
TestLatin1
),
};
NAPI_CALL
(
env
,
napi_define_properties
(
env
,
exports
,
sizeof
(
properties
)
/
sizeof
(
*
properties
),
properties
));
return
exports
;
}
EXTERN_C_END
static
napi_module
demoModule
=
{
.
nm_version
=
1
,
.
nm_flags
=
0
,
.
nm_filename
=
nullptr
,
.
nm_register_func
=
Init
,
.
nm_modname
=
"teststring"
,
.
nm_priv
=
((
void
*
)
0
),
.
reserved
=
{
0
},
};
extern
"C"
__attribute__
((
constructor
))
void
RegisterModule
(
void
)
{
napi_module_register
(
&
demoModule
);
}
arkui/ace_napi_test/entry/src/main/ets/MainAbility/app.ets
0 → 100644
浏览文件 @
a23c2cf6
// @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
arkui/ace_napi_test/entry/src/main/ets/MainAbility/pages/index.ets
0 → 100644
浏览文件 @
a23c2cf6
// @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%')
}
}
arkui/ace_napi_test/entry/src/main/ets/TestAbility/app.ets
0 → 100644
浏览文件 @
a23c2cf6
// @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
arkui/ace_napi_test/entry/src/main/ets/TestAbility/pages/index.ets
0 → 100644
浏览文件 @
a23c2cf6
// @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
arkui/ace_napi_test/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
0 → 100644
浏览文件 @
a23c2cf6
// @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
arkui/ace_napi_test/entry/src/main/ets/test/List.test.ets
0 → 100644
浏览文件 @
a23c2cf6
/*
* 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
arkui/ace_napi_test/entry/src/main/ets/test/NativeApiStringTest.ets
0 → 100644
浏览文件 @
a23c2cf6
// @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
(
'napiStringTest001 START'
);
value
=
testString
.
TestLatin1
(
empty
)
console
.
info
(
'napiStringTest001 testString result is: '
+
value
);
expect
(
value
)
.
assertEqual
(
empty
)
done
();
});
})
}
arkui/ace_napi_test/entry/src/main/resources/base/element/string.json
0 → 100644
浏览文件 @
a23c2cf6
{
"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
arkui/ace_napi_test/entry/src/main/resources/base/media/icon.png
0 → 100644
浏览文件 @
a23c2cf6
6.6 KB
arkui/ace_napi_test/signature/openharmony_sx.p7b
0 → 100644
浏览文件 @
a23c2cf6
文件已添加
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录