Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
31c9e509
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看板
提交
31c9e509
编写于
4月 19, 2023
作者:
Y
y00314596
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add by yangqing3@huawei.com
Signed-off-by:
N
y00314596
<
yangqing3@huawei.com
>
上级
d47f951c
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
269 addition
and
258 deletion
+269
-258
global/BUILD.gn
global/BUILD.gn
+1
-0
global/global_napi_test/entry/src/main/cpp/BUILD.gn
global/global_napi_test/entry/src/main/cpp/BUILD.gn
+7
-2
global/global_napi_test/entry/src/main/cpp/napi/global_napi_test.cpp
...al_napi_test/entry/src/main/cpp/napi/global_napi_test.cpp
+213
-0
global/global_napi_test/entry/src/main/cpp/napi/test_string.cpp
.../global_napi_test/entry/src/main/cpp/napi/test_string.cpp
+0
-240
global/global_napi_test/entry/src/main/ets/test/NativeApiStringTest.ets
...napi_test/entry/src/main/ets/test/NativeApiStringTest.ets
+48
-16
未找到文件。
global/BUILD.gn
浏览文件 @
31c9e509
...
...
@@ -17,6 +17,7 @@ group("global") {
testonly = true
if (is_standard_system) {
deps = [
"global_napi_test:ActsGlobalNapiTest",
"i18n_standard/intljs:intljs_test",
"perf/perfjs:perfjs_test",
"resmgr_standard/resmgrjs:resmgrjs_test",
...
...
global/global_napi_test/entry/src/main/cpp/BUILD.gn
浏览文件 @
31c9e509
...
...
@@ -30,7 +30,7 @@ config("public_config") {
}
ohos_shared_library("resmgrndk") {
sources = [ "./napi/
test_string
.cpp" ]
sources = [ "./napi/
global_napi_test
.cpp" ]
if (target_cpu == "arm") {
libs = [ "${clang_base_path}/../libcxx-ndk/lib/arm-linux-ohos/c++/libc++_shared.so" ]
} else if (target_cpu == "arm64") {
...
...
@@ -38,7 +38,10 @@ ohos_shared_library("resmgrndk") {
} else {
libs = []
}
include_dirs = [ "//test/xts/acts/arkui/ace_napi_test/entry/src/main/cpp" ]
include_dirs = [
"//base/global/resource_management/interfaces/native/resource/include",
"//test/xts/acts/arkui/ace_napi_test/entry/src/main/cpp",
]
configs = [ ":config" ]
deps = [
...
...
@@ -47,5 +50,7 @@ ohos_shared_library("resmgrndk") {
"//foundation/arkui/napi:ace_napi",
]
external_deps = [ "hiviewdfx_hilog_native:libhilog" ]
output_extension = "so"
}
global/global_napi_test/entry/src/main/cpp/napi/global_napi_test.cpp
0 → 100644
浏览文件 @
31c9e509
/*
* 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 "napi/native_api.h"
#include "raw_file_manager.h"
#include "raw_file.h"
#include "raw_dir.h"
#include "hilog/log.h"
#include <js_native_api.h>
#include <js_native_api_types.h>
#include <vector>
int
GLOBAL_RESMGR
=
0xDDD
;
static
napi_value
GetFileList
(
napi_env
env
,
napi_callback_info
info
)
{
size_t
argc
=
2
;
napi_value
argv
[
2
]
=
{
nullptr
};
napi_get_cb_info
(
env
,
info
,
&
argc
,
argv
,
nullptr
,
nullptr
);
napi_valuetype
valueType
;
napi_typeof
(
env
,
argv
[
0
],
&
valueType
);
NativeResourceManager
*
mNativeResMgr
=
OH_ResourceManager_InitNativeResourceManager
(
env
,
argv
[
0
]);
size_t
strSize
;
char
strBuf
[
256
];
napi_get_value_string_utf8
(
env
,
argv
[
1
],
strBuf
,
sizeof
(
strBuf
),
&
strSize
);
std
::
string
filename
(
strBuf
,
strSize
);
RawDir
*
rawDir
=
OH_ResourceManager_OpenRawDir
(
mNativeResMgr
,
filename
.
c_str
());
int
count
=
OH_ResourceManager_GetRawFileCount
(
rawDir
);
std
::
vector
<
std
::
string
>
tempArray
;
for
(
int
i
=
0
;
i
<
count
;
i
++
)
{
std
::
string
filename
=
OH_ResourceManager_GetRawFileName
(
rawDir
,
i
);
tempArray
.
emplace_back
(
filename
);
}
napi_value
fileList
;
napi_create_array
(
env
,
&
fileList
);
for
(
size_t
i
=
0
;
i
<
tempArray
.
size
();
i
++
)
{
napi_value
jsString
;
napi_create_string_utf8
(
env
,
tempArray
[
i
].
c_str
(),
NAPI_AUTO_LENGTH
,
&
jsString
);
napi_set_element
(
env
,
fileList
,
i
,
jsString
);
}
OH_ResourceManager_CloseRawDir
(
rawDir
);
OH_ResourceManager_ReleaseNativeResourceManager
(
mNativeResMgr
);
return
fileList
;
}
napi_value
CreateJsArrayValue
(
napi_env
env
,
std
::
unique_ptr
<
uint8_t
[]
>
&
data
,
long
length
)
{
napi_value
buffer
;
napi_status
status
=
napi_create_external_arraybuffer
(
env
,
data
.
get
(),
length
,
[](
napi_env
env
,
void
*
data
,
void
*
hint
)
{
delete
[]
static_cast
<
char
*>
(
data
);
},
nullptr
,
&
buffer
);
if
(
status
!=
napi_ok
)
{
return
nullptr
;
}
napi_value
result
=
nullptr
;
status
=
napi_create_typedarray
(
env
,
napi_uint8_array
,
length
,
buffer
,
0
,
&
result
);
if
(
status
!=
napi_ok
)
{
return
nullptr
;
}
data
.
release
();
return
result
;
}
static
napi_value
GetRawFileContent
(
napi_env
env
,
napi_callback_info
info
)
{
size_t
argc
=
2
;
napi_value
argv
[
2
]
=
{
nullptr
};
napi_get_cb_info
(
env
,
info
,
&
argc
,
argv
,
nullptr
,
nullptr
);
napi_valuetype
valueType
;
napi_typeof
(
env
,
argv
[
0
],
&
valueType
);
NativeResourceManager
*
mNativeResMgr
=
OH_ResourceManager_InitNativeResourceManager
(
env
,
argv
[
0
]);
size_t
strSize
;
char
strBuf
[
256
];
napi_get_value_string_utf8
(
env
,
argv
[
1
],
strBuf
,
sizeof
(
strBuf
),
&
strSize
);
std
::
string
filename
(
strBuf
,
strSize
);
RawFile
*
rawFile
=
OH_ResourceManager_OpenRawFile
(
mNativeResMgr
,
filename
.
c_str
());
if
(
rawFile
!=
nullptr
)
{
return
nullptr
;
}
long
len
=
OH_ResourceManager_GetRawFileSize
(
rawFile
);
std
::
unique_ptr
<
uint8_t
[]
>
data
=
std
::
make_unique
<
uint8_t
[]
>
(
len
);
long
offset
=
OH_ResourceManager_GetRawFileOffset
(
rawFile
);
if
(
offset
==
0
){
return
nullptr
;
}
long
size
=
OH_ResourceManager_SeekRawFile
(
rawFile
,
1
,
0
);
if
(
size
==
-
1
){
return
nullptr
;
}
int
res
=
OH_ResourceManager_ReadRawFile
(
rawFile
,
data
.
get
(),
len
);
if
(
res
==
0
){
return
nullptr
;
}
OH_ResourceManager_CloseRawFile
(
rawFile
);
OH_ResourceManager_ReleaseNativeResourceManager
(
mNativeResMgr
);
return
CreateJsArrayValue
(
env
,
data
,
len
);
}
napi_value
createJsFileDescriptor
(
napi_env
env
,
RawFileDescriptor
&
descriptor
)
{
napi_value
result
;
napi_status
status
=
napi_create_object
(
env
,
&
result
);
if
(
status
!=
napi_ok
)
{
return
result
;
}
napi_value
fd
;
status
=
napi_create_int32
(
env
,
descriptor
.
fd
,
&
fd
);
if
(
status
!=
napi_ok
)
{
return
result
;
}
status
=
napi_set_named_property
(
env
,
result
,
"fd"
,
fd
);
if
(
status
!=
napi_ok
)
{
return
result
;
}
napi_value
offset
;
status
=
napi_create_int64
(
env
,
descriptor
.
start
,
&
offset
);
if
(
status
!=
napi_ok
)
{
return
result
;
}
status
=
napi_set_named_property
(
env
,
result
,
"offset"
,
offset
);
if
(
status
!=
napi_ok
)
{
return
result
;
}
napi_value
length
;
status
=
napi_create_int64
(
env
,
descriptor
.
length
,
&
length
);
if
(
status
!=
napi_ok
)
{
return
result
;
}
status
=
napi_set_named_property
(
env
,
result
,
"length"
,
length
);
if
(
status
!=
napi_ok
)
{
return
result
;
}
return
result
;
}
static
napi_value
GetRawFileDescriptor
(
napi_env
env
,
napi_callback_info
info
)
{
size_t
argc
=
2
;
napi_value
argv
[
2
]
=
{
nullptr
};
napi_get_cb_info
(
env
,
info
,
&
argc
,
argv
,
nullptr
,
nullptr
);
napi_valuetype
valueType
;
napi_typeof
(
env
,
argv
[
0
],
&
valueType
);
NativeResourceManager
*
mNativeResMgr
=
OH_ResourceManager_InitNativeResourceManager
(
env
,
argv
[
0
]);
size_t
strSize
;
char
strBuf
[
256
];
napi_get_value_string_utf8
(
env
,
argv
[
1
],
strBuf
,
sizeof
(
strBuf
),
&
strSize
);
std
::
string
filename
(
strBuf
,
strSize
);
RawFile
*
rawFile
=
OH_ResourceManager_OpenRawFile
(
mNativeResMgr
,
filename
.
c_str
());
if
(
rawFile
!=
nullptr
)
{
return
nullptr
;
}
RawFileDescriptor
descriptor
;
OH_ResourceManager_GetRawFileDescriptor
(
rawFile
,
descriptor
);
OH_ResourceManager_ReleaseRawFileDescriptor
(
descriptor
);
OH_ResourceManager_CloseRawFile
(
rawFile
);
OH_ResourceManager_ReleaseNativeResourceManager
(
mNativeResMgr
);
return
createJsFileDescriptor
(
env
,
descriptor
);
}
EXTERN_C_START
static
napi_value
Init
(
napi_env
env
,
napi_value
exports
)
{
napi_property_descriptor
desc
[]
=
{
{
"GetFileList"
,
nullptr
,
GetFileList
,
nullptr
,
nullptr
,
nullptr
,
napi_default
,
nullptr
},
{
"GetRawFileContent"
,
nullptr
,
GetRawFileContent
,
nullptr
,
nullptr
,
nullptr
,
napi_default
,
nullptr
},
{
"GetRawFileDescriptor"
,
nullptr
,
GetRawFileDescriptor
,
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
=
"resmgrndk"
,
.
nm_priv
=
((
void
*
)
0
),
.
reserved
=
{
0
},
};
extern
"C"
__attribute__
((
constructor
))
void
RegisterEntryModule
(
void
)
{
napi_module_register
(
&
demoModule
);
}
\ No newline at end of file
global/global_napi_test/entry/src/main/cpp/napi/test_string.cpp
已删除
100644 → 0
浏览文件 @
d47f951c
/*
* 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 "native_common.h"
#include "rawfile/raw_file_manager.h"
#include <fstream>
#include <memory>
#include <vector>
#include "hilog/log.h"
#include "node_api.h"
namespace
OHOS
{
namespace
Global
{
namespace
Resource
{
#define GET_PARAMS(env, info, num) \
size_t argc = num; \
napi_value argv[num] = {nullptr}; \
napi_value thisVar = nullptr; \
void *data = nullptr; \
napi_get_cb_info(env, info , &argc, argv, &thisVar, &data)
void
NdkAsyncContext
::
SetErrorMsg
(
const
std
::
string
&
msg
)
{
errMsg_
=
msg
;
success_
=
false
;
}
napi_async_execute_callback
TestRawFileExecute
()
{
return
[](
napi_env
env
,
void
*
data
)
{
NdkAsyncContext
*
asyncContext
=
static_cast
<
NdkAsyncContext
*>
(
data
);
// test OH_ResourceManager_OpenRawDir
RawDir
*
rawDir
=
OH_ResourceManager_OpenRawDir
(
asyncContext
->
ndk_
,
asyncContext
->
path_
.
c_str
());
// test OH_ResourceManager_GetRawFileCount
int
count
=
OH_ResourceManager_GetRawFileCount
(
rawDir
);
// test OH_ResourceManager_GetRawFileName
for
(
int
i
=
0
;
i
<
count
;
i
++
)
{
std
::
string
tempFileName
=
OH_ResourceManager_GetRawFileName
(
rawDir
,
i
);
}
// test OH_ResourceManager_OpenRawFile
std
::
string
fileName
=
OH_ResourceManager_GetRawFileName
(
rawDir
,
0
);
asyncContext
->
path_
=
fileName
;
RawFile
*
rawFile
=
OH_ResourceManager_OpenRawFile
(
asyncContext
->
ndk_
,
fileName
.
c_str
());
// test OH_ResourceManager_GetRawFileSize
asyncContext
->
len_
=
OH_ResourceManager_GetRawFileSize
(
rawFile
);
// // test OH_ResourceManager_SeekRawFile
// // test OH_ResourceManager_GetRawFileOffset
// test OH_ResourceManager_GetRawFileDescriptor
RawFileDescriptor
descriptor
;
bool
getFd
=
OH_ResourceManager_GetRawFileDescriptor
(
rawFile
,
descriptor
);
// test OH_ResourceManager_ReadRawFile
asyncContext
->
mediaData
=
std
::
make_unique
<
char
[]
>
(
asyncContext
->
len_
);
// HiLog::Error(LABEL, "ReadRawFile:%{public}d", OH_ResourceManager_ReadRawFile(rawFile, asyncContext->mediaData.get(), asyncContext->len_));
// test OH_ResourceManager_ReleaseRawFileDescriptor
OH_ResourceManager_ReleaseRawFileDescriptor
(
descriptor
);
// test OH_ResourceManager_CloseRawFile
OH_ResourceManager_CloseRawFile
(
rawFile
);
// test OH_ResourceManager_CloseRawDir
OH_ResourceManager_CloseRawDir
(
rawDir
);
// test OH_ResourceManager_ReleaseNativeResourceManager
OH_ResourceManager_ReleaseNativeResourceManager
(
asyncContext
->
ndk_
);
asyncContext
->
createValueFunc_
=
[](
napi_env
env
,
NdkAsyncContext
&
context
)
->
napi_value
{
napi_value
buffer
;
napi_status
status
=
napi_create_external_arraybuffer
(
env
,
context
.
mediaData
.
get
(),
context
.
len_
,
[](
napi_env
env
,
void
*
data
,
void
*
hint
)
{
delete
[]
static_cast
<
char
*>
(
data
);
},
nullptr
,
&
buffer
);
if
(
status
!=
napi_ok
)
{
context
.
SetErrorMsg
(
"Failed to create media external array buffer"
);
return
nullptr
;
}
napi_value
result
=
nullptr
;
status
=
napi_create_typedarray
(
env
,
napi_uint8_array
,
context
.
len_
,
buffer
,
0
,
&
result
);
if
(
status
!=
napi_ok
)
{
context
.
SetErrorMsg
(
"Failed to create media typed array"
);
return
nullptr
;
}
context
.
mediaData
.
release
();
return
result
;
};
};
}
auto
completeFunc
=
[](
napi_env
env
,
napi_status
status
,
void
*
data
)
{
NdkAsyncContext
*
asyncContext
=
static_cast
<
NdkAsyncContext
*>
(
data
);
napi_value
finalResult
=
nullptr
;
if
(
asyncContext
->
createValueFunc_
!=
nullptr
)
{
finalResult
=
asyncContext
->
createValueFunc_
(
env
,
*
asyncContext
);
}
napi_value
result
[]
=
{
nullptr
,
nullptr
};
if
(
asyncContext
->
success_
)
{
napi_get_undefined
(
env
,
&
result
[
0
]);
result
[
1
]
=
finalResult
;
}
else
{
napi_value
message
=
nullptr
;
napi_create_string_utf8
(
env
,
asyncContext
->
errMsg_
.
c_str
(),
NAPI_AUTO_LENGTH
,
&
message
);
napi_create_error
(
env
,
nullptr
,
message
,
&
result
[
0
]);
napi_get_undefined
(
env
,
&
result
[
1
]);
}
do
{
if
(
asyncContext
->
deferred_
)
{
if
(
asyncContext
->
success_
)
{
if
(
napi_resolve_deferred
(
env
,
asyncContext
->
deferred_
,
result
[
1
])
!=
napi_ok
)
{
}
}
else
{
if
(
napi_reject_deferred
(
env
,
asyncContext
->
deferred_
,
result
[
0
])
!=
napi_ok
)
{
}
}
}
else
{
napi_value
callback
=
nullptr
;
napi_status
status
=
napi_get_reference_value
(
env
,
asyncContext
->
callbackRef_
,
&
callback
);
if
(
status
!=
napi_ok
)
{
break
;
}
napi_value
userRet
=
nullptr
;
status
=
napi_call_function
(
env
,
nullptr
,
callback
,
sizeof
(
result
)
/
sizeof
(
napi_value
),
result
,
&
userRet
);
if
(
status
!=
napi_ok
)
{
break
;
}
status
=
napi_delete_reference
(
env
,
asyncContext
->
callbackRef_
);
if
(
status
!=
napi_ok
)
{
break
;
}
}
}
while
(
false
);
napi_delete_async_work
(
env
,
asyncContext
->
work_
);
delete
asyncContext
;
};
napi_value
GetResourceManager
(
napi_env
env
,
napi_callback_info
info
)
{
GET_PARAMS
(
env
,
info
,
3
);
std
::
unique_ptr
<
NdkAsyncContext
>
asyncContext
=
std
::
make_unique
<
NdkAsyncContext
>
();
for
(
size_t
i
=
0
;
i
<
argc
;
i
++
)
{
napi_valuetype
valueType
;
napi_typeof
(
env
,
argv
[
i
],
&
valueType
);
if
(
i
==
0
&&
valueType
==
napi_string
)
{
size_t
len
=
0
;
napi_status
status
=
napi_get_value_string_utf8
(
env
,
argv
[
0
],
nullptr
,
0
,
&
len
);
if
(
status
!=
napi_ok
)
{
return
nullptr
;
}
std
::
vector
<
char
>
buf
(
len
+
1
);
status
=
napi_get_value_string_utf8
(
env
,
argv
[
0
],
buf
.
data
(),
len
+
1
,
&
len
);
if
(
status
!=
napi_ok
)
{
return
nullptr
;
}
asyncContext
->
path_
=
buf
.
data
();
}
else
if
(
i
==
1
&&
valueType
==
napi_object
)
{
// test OH_ResourceManager_InitNativeResourceManager
asyncContext
->
ndk_
=
OH_ResourceManager_InitNativeResourceManager
(
env
,
argv
[
i
]);
}
else
if
(
i
==
2
&&
valueType
==
napi_function
)
{
napi_create_reference
(
env
,
argv
[
i
],
1
,
&
asyncContext
->
callbackRef_
);
break
;
}
else
{
// self resorucemanager with promise
}
}
napi_value
result
=
nullptr
;
if
(
asyncContext
->
callbackRef_
==
nullptr
)
{
napi_create_promise
(
env
,
&
asyncContext
->
deferred_
,
&
result
);
}
else
{
napi_get_undefined
(
env
,
&
result
);
}
napi_value
resource
=
nullptr
;
napi_create_string_utf8
(
env
,
"testRawFile"
,
NAPI_AUTO_LENGTH
,
&
resource
);
napi_status
status
=
napi_create_async_work
(
env
,
nullptr
,
resource
,
TestRawFileExecute
(),
completeFunc
,
static_cast
<
void
*>
(
asyncContext
.
get
()),
&
asyncContext
->
work_
);
if
(
status
!=
napi_ok
)
{
return
result
;
}
status
=
napi_queue_async_work
(
env
,
asyncContext
->
work_
);
if
(
status
!=
napi_ok
)
{
return
result
;
}
asyncContext
.
release
();
return
result
;
}
EXTERN_C_START
static
napi_value
Init
(
napi_env
env
,
napi_value
exports
)
{
napi_property_descriptor
desc
[]
=
{
{
"testRawFile"
,
nullptr
,
GetResourceManager
,
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
=
"resmgrndk"
,
.
nm_priv
=
((
void
*
)
0
),
.
reserved
=
{
0
},
};
extern
"C"
__attribute__
((
constructor
))
void
RegisterModule
(
void
)
{
napi_module_register
(
&
demoModule
);
}
}
}
}
\ No newline at end of file
global/global_napi_test/entry/src/main/ets/test/NativeApiStringTest.ets
浏览文件 @
31c9e509
...
...
@@ -21,30 +21,62 @@ import ndk from 'libresmgrndk.so'
export default function abilityTest() {
describe('ActsAbilityTest', function () {
it('assertContain',0, function () {
console.info("it begin")
let a = 'abc'
let b = 'b'
expect(a).assertContain(b)
expect(a).assertEqual(a)
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_NDK_0100
* @tc.name test ResourceManager NDK interface
* @tc.desc test ResourceManager NDK interface
*/
it('getResourceManager_ndktest_0100', 0, async function (done) {
console.log("getResourceManager_ndktest_0100 1");
resManager.getResourceManager().then(mgr => {
console.log("getResourceManager_ndktest_0100 2");
expect(mgr !== null).assertTrue();
console.log("getResourceManager_ndktest_0100 22");
let value = ndk.GetFileList(mgr,"test");
console.log("getResourceManager_ndktest_0100 3");
console.log("getResourceManager_ndktest_0100" + value);
console.log("getResourceManager_ndktest_0100" + value.length);
expect(value.length > 0).assertTrue();
})
done();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_NDK_0200
* @tc.name test ResourceManager NDK interface
* @tc.desc test ResourceManager NDK interface
*/
it('getResourceManager_ndktest_0200', 0, async function (done) {
console.log("getResourceManager_ndktest_0200 1");
resManager.getResourceManager().then(mgr => {
console.log("getResourceManager_ndktest_0200 2");
expect(mgr !== null).assertTrue();
console.log("getResourceManager_ndktest_0200 22");
let value = ndk.GetRawFileContent(mgr,"test/aa.xml");
console.log("getResourceManager_ndktest_0200 3");
console.log("getResourceManager_ndktest_0200" + value);
expect(value !== null).assertTrue();
})
done();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_NDK_0300
* @tc.name test ResourceManager NDK interface
* @tc.desc test ResourceManager NDK interface
*/
it('getResourceManager_ndktest_0300', 0, async function (done) {
console.log("getResourceManager_ndktest_0300 1");
resManager.getResourceManager().then(mgr => {
console.log("getResourceManager_ndktest_0300 2");
expect(mgr !== null).assertTrue();
ndk.testRawFile("test",mgr,(error,value) => {
if(error != null){
console.log("getResourceManager_ndktest_0100" + error);
} else{
console.log("getResourceManager_ndktest_0100" + value.length);
expect(value.length > 0).assertTrue();
}
});
console.log("getResourceManager_ndktest_0300 22");
let value = ndk.GetRawFileDescriptor(mgr,"test/aa.xml");
console.log("getResourceManager_ndktest_0300 3");
console.log("getResourceManager_ndktest_0300" + value.fd);
console.log("getResourceManager_ndktest_0300" + value.offset);
console.log("getResourceManager_ndktest_0300" + value.length);
expect(value !== null).assertTrue();
})
done();
})
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录