Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
92ef7094
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看板
未验证
提交
92ef7094
编写于
11月 03, 2022
作者:
O
openharmony_ci
提交者:
Gitee
11月 03, 2022
浏览文件
操作
浏览文件
下载
差异文件
!6296 add getstringvalue code to 1018
Merge pull request !6296 from 杨清/cherry-pick-1667304275
上级
d0b8aa25
02ea9fcf
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
315 addition
and
81 deletion
+315
-81
global/resmgr_standard/resmgrjs/src/main/js/test/Resmgr.test.js
.../resmgr_standard/resmgrjs/src/main/js/test/Resmgr.test.js
+303
-77
global/resmgr_standard/resmgrjs/src/main/resources/base/element/string.json
...dard/resmgrjs/src/main/resources/base/element/string.json
+12
-4
未找到文件。
global/resmgr_standard/resmgrjs/src/main/js/test/Resmgr.test.js
浏览文件 @
92ef7094
...
...
@@ -99,18 +99,34 @@ describe('resMgrTest', function () {
done
();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_1900
* @tc.name test getString method in callback mode
* @tc.desc get the string in callback mode
*/
it
(
'
getString_test_003
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getString
(
$r
(
app
.
string
.
mainability_description
).
id
,
(
err
,
value
)
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getString_test_003
'
+
value
);
expect
(
value
).
assertEqual
(
'
JS_Phone_Empty Feature Ability
'
);
})
})
done
();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_0620
* @tc.name test getString method with resource param in callback mode
* @tc.desc get the string in callback mode
*/
it
(
'
getString
_test_003
'
,
0
,
async
function
(
done
)
{
it
(
'
getString
Value_test_001
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getStringValue
({
bundleName
:
"
ohos.intl.test
"
,
moduleName
:
"
entry
"
,
id
:
$r
(
app
.
string
.
app_name
).
id
},
(
err
,
value
)
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getString
_test_003
'
+
value
);
console
.
log
(
'
getString
Value_test_001
'
+
value
);
expect
(
value
).
assertEqual
(
'
L2Test
'
);
})
})
...
...
@@ -122,13 +138,13 @@ describe('resMgrTest', function () {
* @tc.name test getString method with resource param in promise mode
* @tc.desc get the string in promise mode
*/
it
(
'
getString
_test_004
'
,
0
,
async
function
(
done
)
{
it
(
'
getString
Value_test_002
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getStringValue
({
bundleName
:
"
ohos.intl.test
"
,
moduleName
:
"
entry
"
,
id
:
$r
(
app
.
string
.
app_name
).
id
}).
then
(
value
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getString
_test_004
'
+
value
);
console
.
log
(
'
getString
Value_test_002
'
+
value
);
expect
(
value
).
assertEqual
(
'
L2Test
'
);
})
})
...
...
@@ -140,11 +156,11 @@ describe('resMgrTest', function () {
* @tc.name test getString method in callback mode
* @tc.desc get the string in callback mode
*/
it
(
'
getString
_test_006
'
,
0
,
async
function
(
done
)
{
it
(
'
getString
Value_test_003
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getStringValue
(
$r
(
app
.
string
.
app_name
).
id
,
(
err
,
value
)
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getString
_test_006
'
+
value
);
console
.
log
(
'
getString
Value_test_003
'
+
value
);
expect
(
value
).
assertEqual
(
'
L2Test
'
);
})
})
...
...
@@ -156,17 +172,243 @@ describe('resMgrTest', function () {
* @tc.name test getString method in promise mode
* @tc.desc get the string in promise mode
*/
it
(
'
getString
_test_007
'
,
0
,
async
function
(
done
)
{
it
(
'
getString
Value_test_004
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getStringValue
(
$r
(
app
.
string
.
app_name
).
id
).
then
(
value
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getString
_test_007
'
+
value
);
console
.
log
(
'
getString
Value_test_004
'
+
value
);
expect
(
value
).
assertEqual
(
'
L2Test
'
);
})
})
done
();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_0500
* @tc.name test getString method in callback mode
* @tc.desc get the string in callback mode
*/
it
(
'
getStringValue_test_005
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
try
{
// 0x1001 id not exist,throw 9001001 error code
mgr
.
getStringValue
(
0x1001
,
(
err
,
value
)
=>
{
if
(
err
){
console
.
log
(
'
getStringValue_test_005 err.code
'
+
err
.
code
);
console
.
log
(
'
getStringValue_test_005 err.message
'
+
err
.
message
);
expect
(
err
.
code
==
9001001
).
assertTrue
();
done
();
}
else
{
console
.
log
(
'
getStringValue_test_005 2
'
);
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getStringValue_test_005
'
+
value
);
done
();
}
})
}
catch
(
e
){
console
.
log
(
'
getStringValue_test_005 e.code
'
+
e
.
code
);
console
.
log
(
'
getStringValue_test_005 e.message
'
+
e
.
message
);
}
})
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_0500
* @tc.name test getString method in callback mode
* @tc.desc get the string in callback mode
*/
it
(
'
getStringValue_test_006
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
try
{
// 0x01000000 id is integer resource,throw 9001002 error code
mgr
.
getStringValue
(
0x01000000
,
(
err
,
value
)
=>
{
if
(
err
){
console
.
log
(
'
getStringValue_test_006 err.code
'
+
err
.
code
);
console
.
log
(
'
getStringValue_test_006 err.message
'
+
err
.
message
);
expect
(
err
.
code
==
9001002
).
assertTrue
();
done
();
}
else
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getStringValue_test_006
'
+
value
);
done
();
}
})
}
catch
(
e
){
console
.
log
(
'
getStringValue_test_006 e.code
'
+
e
.
code
);
console
.
log
(
'
getStringValue_test_006 e.message
'
+
e
.
message
);
}
})
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_0500
* @tc.name test getString method in callback mode
* @tc.desc get the string in callback mode
*/
it
(
'
getStringValue_test_007
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
try
{
// 0x01000006 id re-ref,throw 9001006 error code
mgr
.
getStringValue
(
0x01000006
,
(
err
,
value
)
=>
{
if
(
err
){
console
.
log
(
'
getStringValue_test_007 err.code
'
+
err
.
code
);
console
.
log
(
'
getStringValue_test_007 err.message
'
+
err
.
message
);
expect
(
err
.
code
==
9001006
).
assertTrue
();
done
();
}
else
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getStringValue_test_007
'
+
value
);
done
();
}
})
}
catch
(
e
){
console
.
log
(
'
getStringValue_test_007 e.code
'
+
e
.
code
);
console
.
log
(
'
getStringValue_test_007 e.message
'
+
e
.
message
);
}
})
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_0500
* @tc.name test getString method in callback mode
* @tc.desc get the string in callback mode
*/
it
(
'
getStringValue_test_008
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
try
{
// param type not correct,throw 401 error code
mgr
.
getStringValue
(
'
name
'
,
(
err
,
value
)
=>
{
if
(
err
){
console
.
log
(
'
getStringValue_test_008 err.code:
'
+
err
.
code
);
console
.
log
(
'
getStringValue_test_008 err.message:
'
+
err
.
message
);
done
();
}
else
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getStringValue_test_008
'
+
value
);
done
();
}
})
}
catch
(
e
){
console
.
log
(
'
getStringValue_test_008 e.code:
'
+
e
.
code
);
console
.
log
(
'
getStringValue_test_008 e.message
'
+
e
.
message
);
expect
(
e
.
code
==
401
).
assertTrue
();
done
();
}
})
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_0600
* @tc.name test getString method in promise mode
* @tc.desc get the string in promise mode
*/
it
(
'
getStringValue_test_009
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
try
{
// 0x1001 id not exist,throw 9001001 error code
mgr
.
getStringValue
(
0x1001
).
then
(
value
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getStringValue_test_009
'
+
value
);
expect
(
value
).
assertEqual
(
'
L2Test
'
);
done
();
}).
catch
(
error
=>
{
console
.
log
(
'
getStringValue_test_009 error.code
'
+
error
.
code
);
console
.
log
(
'
getStringValue_test_009 error.message
'
+
error
.
message
);
expect
(
error
.
code
==
9001001
).
assertTrue
();
done
();
})
}
catch
(
err
){
console
.
log
(
'
getStringValue_test_009 err.code
'
+
err
.
code
);
console
.
log
(
'
getStringValue_test_009 err.message
'
+
err
.
message
);
done
();
}
})
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_0600
* @tc.name test getString method in promise mode
* @tc.desc get the string in promise mode
*/
it
(
'
getStringValue_test_010
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
try
{
// 0x01000000 id is integer resource,throw 9001002 error code
mgr
.
getStringValue
(
0x01000000
).
then
(
value
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getStringValue_test_010
'
+
value
);
expect
(
value
).
assertEqual
(
'
L2Test
'
);
done
();
}).
catch
(
error
=>
{
console
.
log
(
'
getStringValue_test_010 error.code
'
+
error
.
code
);
console
.
log
(
'
getStringValue_test_010 error.message
'
+
error
.
message
);
expect
(
error
.
code
==
9001002
).
assertTrue
();
done
();
})
}
catch
(
err
){
console
.
log
(
'
getStringValue_test_010 err.code
'
+
err
.
code
);
console
.
log
(
'
getStringValue_test_010 err.message
'
+
err
.
message
);
done
();
}
})
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_0600
* @tc.name test getString method in promise mode
* @tc.desc get the string in promise mode
*/
it
(
'
getStringValue_test_011
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
try
{
// 0x01000006 id re-ref,throw 9001006 error code
mgr
.
getStringValue
(
0x01000006
).
then
(
value
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getStringValue_test_011
'
+
value
);
expect
(
value
).
assertEqual
(
'
L2Test
'
);
done
();
}).
catch
(
error
=>
{
console
.
log
(
'
getStringValue_test_011 error.code
'
+
error
.
code
);
console
.
log
(
'
getStringValue_test_011 error.message
'
+
error
.
message
);
expect
(
error
.
code
==
9001006
).
assertTrue
();
done
();
})
}
catch
(
err
){
console
.
log
(
'
getStringValue_test_011 err.code
'
+
err
.
code
);
console
.
log
(
'
getStringValue_test_011 err.message
'
+
err
.
message
);
done
();
}
})
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_0600
* @tc.name test getString method in promise mode
* @tc.desc get the string in promise mode
*/
it
(
'
getStringValue_test_012
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
try
{
// param type not correct,throw 401 error code
mgr
.
getStringValue
(
'
name
'
).
then
(
value
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getStringValue_test_012
'
+
value
);
expect
(
value
).
assertEqual
(
'
L2Test
'
);
done
();
}).
catch
(
error
=>
{
console
.
log
(
'
getStringValue_test_012 error.code
'
+
error
.
code
);
console
.
log
(
'
getStringValue_test_012 error.message
'
+
error
.
message
);
expect
(
error
.
code
==
401
).
assertTrue
();
done
();
})
}
catch
(
err
){
console
.
log
(
'
getStringValue_test_012 err.code
'
+
err
.
code
);
console
.
log
(
'
getStringValue_test_012 err.message
'
+
err
.
message
);
done
();
}
})
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_0700
* @tc.name test getStringArray method in callback mode
...
...
@@ -216,15 +458,15 @@ describe('resMgrTest', function () {
* @tc.name test getStringArray method with resource param in callback mode
* @tc.desc get the string array in callback mode
*/
it
(
'
getStringArray
_test_003
'
,
0
,
async
function
(
done
)
{
it
(
'
getStringArray
Value_test_001
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getStringArrayValue
({
bundleName
:
"
ohos.intl.test
"
,
moduleName
:
"
entry
"
,
id
:
$r
(
app
.
strarray
.
sizeList
).
id
},
(
err
,
value
)
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getStringArray
_test_003
'
+
value
);
console
.
log
(
'
getStringArray
_test_003
'
+
value
.
length
);
console
.
log
(
'
getStringArray
_test_003
'
+
value
[
0
]);
console
.
log
(
'
getStringArray
Value_test_001
'
+
value
);
console
.
log
(
'
getStringArray
Value_test_001
'
+
value
.
length
);
console
.
log
(
'
getStringArray
Value_test_001
'
+
value
[
0
]);
expect
(
value
.
length
).
assertEqual
(
4
);
expect
(
value
[
0
]).
assertEqual
(
'
small
'
);
expect
(
value
[
1
]).
assertEqual
(
'
middle
'
);
...
...
@@ -240,15 +482,15 @@ describe('resMgrTest', function () {
* @tc.name test getStringArray method with resource param in promise mode
* @tc.desc get the string array in promise mode
*/
it
(
'
getStringArray
_test_004
'
,
0
,
async
function
(
done
)
{
it
(
'
getStringArray
Value_test_002
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getStringArrayValue
({
bundleName
:
"
ohos.intl.test
"
,
moduleName
:
"
entry
"
,
id
:
$r
(
app
.
strarray
.
sizeList
).
id
}).
then
(
value
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getStringArray
_test_004
'
+
value
);
console
.
log
(
'
getStringArray
_test_004
'
+
value
.
length
);
console
.
log
(
'
getStringArray
_test_004
'
+
value
[
0
]);
console
.
log
(
'
getStringArray
Value_test_002
'
+
value
);
console
.
log
(
'
getStringArray
Value_test_002
'
+
value
.
length
);
console
.
log
(
'
getStringArray
Value_test_002
'
+
value
[
0
]);
expect
(
value
.
length
).
assertEqual
(
4
);
expect
(
value
[
0
]).
assertEqual
(
'
small
'
);
expect
(
value
[
1
]).
assertEqual
(
'
middle
'
);
...
...
@@ -264,13 +506,13 @@ describe('resMgrTest', function () {
* @tc.name test getStringArray method in callback mode
* @tc.desc get the string array in callback mode
*/
it
(
'
getStringArray
_test_005
'
,
0
,
async
function
(
done
)
{
it
(
'
getStringArray
Value_test_003
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getStringArrayValue
(
$r
(
app
.
strarray
.
sizeList
).
id
,
(
err
,
value
)
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getStringArray
_test_005
'
+
value
);
console
.
log
(
'
getStringArray
_test_005
'
+
value
.
length
);
console
.
log
(
'
getStringArray
_test_005
'
+
value
[
0
]);
console
.
log
(
'
getStringArray
Value_test_003
'
+
value
);
console
.
log
(
'
getStringArray
Value_test_003
'
+
value
.
length
);
console
.
log
(
'
getStringArray
Value_test_003
'
+
value
[
0
]);
expect
(
value
.
length
).
assertEqual
(
4
);
expect
(
value
[
0
]).
assertEqual
(
'
small
'
);
expect
(
value
[
1
]).
assertEqual
(
'
middle
'
);
...
...
@@ -286,13 +528,13 @@ describe('resMgrTest', function () {
* @tc.name test getStringArray method in promise mode
* @tc.desc get the string array in promise mode
*/
it
(
'
getStringArray
_test_006
'
,
0
,
async
function
(
done
)
{
it
(
'
getStringArray
Value_test_004
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getStringArrayValue
(
$r
(
app
.
strarray
.
sizeList
).
id
).
then
(
value
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getStringArray
_test_006
'
+
value
);
console
.
log
(
'
getStringArray
_test_006
'
+
value
.
length
);
console
.
log
(
'
getStringArray
_test_006
'
+
value
[
0
]);
console
.
log
(
'
getStringArray
Value_test_004
'
+
value
);
console
.
log
(
'
getStringArray
Value_test_004
'
+
value
.
length
);
console
.
log
(
'
getStringArray
Value_test_004
'
+
value
[
0
]);
expect
(
value
.
length
).
assertEqual
(
4
);
expect
(
value
[
0
]).
assertEqual
(
'
small
'
);
expect
(
value
[
1
]).
assertEqual
(
'
middle
'
);
...
...
@@ -338,12 +580,12 @@ describe('resMgrTest', function () {
* @tc.name test getMedia method with resource param in callback mode
* @tc.desc get the media in callback mode
*/
it
(
'
getMedia
_test_003
'
,
0
,
async
function
(
done
)
{
it
(
'
getMedia
Content_test_001
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getMediaContent
({
bundleName
:
"
ohos.intl.test
"
,
moduleName
:
"
entry
"
,
id
:
$r
(
app
.
media
.
icon
).
id
},
(
err
,
value
)
=>
{
console
.
log
(
'
getMedia
_test_003
'
+
value
.
length
);
console
.
log
(
'
getMedia
Content_test_001
'
+
value
.
length
);
expect
(
value
.
length
>
0
).
assertTrue
();
})
})
...
...
@@ -355,12 +597,12 @@ describe('resMgrTest', function () {
* @tc.name test getMedia method with resource param in promise mode
* @tc.desc get the media in promise mode
*/
it
(
'
getMedia
_test_004
'
,
0
,
async
function
(
done
)
{
it
(
'
getMedia
Content_test_002
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getMediaContent
({
bundleName
:
"
ohos.intl.test
"
,
moduleName
:
"
entry
"
,
id
:
$r
(
app
.
media
.
icon
).
id
}).
then
(
value
=>
{
console
.
log
(
'
getMedia
_test_004
'
+
value
.
length
);
console
.
log
(
'
getMedia
Content_test_002
'
+
value
.
length
);
expect
(
value
.
length
>
0
).
assertTrue
();
})
})
...
...
@@ -372,10 +614,10 @@ describe('resMgrTest', function () {
* @tc.name test getMedia method in callback mode
* @tc.desc get the media in callback mode
*/
it
(
'
getMedia
_test_005
'
,
0
,
async
function
(
done
)
{
it
(
'
getMedia
Content_test_003
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getMediaContent
(
$r
(
app
.
media
.
icon
).
id
,
(
err
,
value
)
=>
{
console
.
log
(
'
getMedia
_test_005
'
+
value
.
length
);
console
.
log
(
'
getMedia
Content_test_003
'
+
value
.
length
);
expect
(
value
.
length
>
0
).
assertTrue
();
})
})
...
...
@@ -387,10 +629,10 @@ describe('resMgrTest', function () {
* @tc.name test getMedia method in promise mode
* @tc.desc get the media in promise mode
*/
it
(
'
getMedia
_test_006
'
,
0
,
async
function
(
done
)
{
it
(
'
getMedia
Content_test_004
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getMediaContent
(
$r
(
app
.
media
.
icon
).
id
).
then
(
value
=>
{
console
.
log
(
'
getMedia
_test_006
'
+
value
.
length
);
console
.
log
(
'
getMedia
Content_test_004
'
+
value
.
length
);
expect
(
value
.
length
>
0
).
assertTrue
();
})
})
...
...
@@ -432,13 +674,13 @@ describe('resMgrTest', function () {
* @tc.name test getMediaBase64 method with resource param in callback mode
* @tc.desc get the media base64 in callback mode
*/
it
(
'
getMedia
Base64_test_003
'
,
0
,
async
function
(
done
)
{
it
(
'
getMedia
ContentBase64_test_001
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getMediaContentBase64
({
bundleName
:
"
ohos.intl.test
"
,
moduleName
:
"
entry
"
,
id
:
$r
(
app
.
media
.
icon
).
id
},
(
err
,
value
)
=>
{
expect
(
value
.
length
>
0
).
assertTrue
();
console
.
log
(
'
getMedia
Base64_test_003
'
+
value
);
console
.
log
(
'
getMedia
ContentBase64_test_001
'
+
value
);
})
})
done
();
...
...
@@ -449,13 +691,13 @@ describe('resMgrTest', function () {
* @tc.name test getMediaBase64 method with resource param in promise mode
* @tc.desc get the media base64 in promise mode
*/
it
(
'
getMedia
Base64_test_004
'
,
0
,
async
function
(
done
)
{
it
(
'
getMedia
ContentBase64_test_002
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getMediaContentBase64
({
bundleName
:
"
ohos.intl.test
"
,
moduleName
:
"
entry
"
,
id
:
$r
(
app
.
media
.
icon
).
id
}).
then
(
value
=>
{
expect
(
value
.
length
>
0
).
assertTrue
();
console
.
log
(
'
getMedia
Base64_test_004
'
+
value
);
console
.
log
(
'
getMedia
ContentBase64_test_002
'
+
value
);
})
})
done
();
...
...
@@ -466,11 +708,11 @@ describe('resMgrTest', function () {
* @tc.name test getMediaBase64 method in callback mode
* @tc.desc get the media base64 in callback mode
*/
it
(
'
getMedia
Base64_test_005
'
,
0
,
async
function
(
done
)
{
it
(
'
getMedia
ContentBase64_test_003
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getMediaContentBase64
(
$r
(
app
.
media
.
icon
).
id
,
(
err
,
value
)
=>
{
expect
(
value
.
length
>
0
).
assertTrue
();
console
.
log
(
'
getMedia
Base64_test_005
'
+
value
);
console
.
log
(
'
getMedia
ContentBase64_test_003
'
+
value
);
})
})
done
();
...
...
@@ -481,11 +723,11 @@ describe('resMgrTest', function () {
* @tc.name test getMediaBase64 method in promise mode
* @tc.desc get the media base64 in promise mode
*/
it
(
'
getMedia
Base64_test_006
'
,
0
,
async
function
(
done
)
{
it
(
'
getMedia
ContentBase64_test_004
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getMediaContentBase64
(
$r
(
app
.
media
.
icon
).
id
).
then
(
value
=>
{
expect
(
value
.
length
>
0
).
assertTrue
();
console
.
log
(
'
getMedia
Base64_test_002
'
+
value
);
console
.
log
(
'
getMedia
ContentBase64_test_004
'
+
value
);
})
})
done
();
...
...
@@ -600,13 +842,13 @@ describe('resMgrTest', function () {
* @tc.name test getPluralString method with resource param in callback mode
* @tc.desc get the plural string in callback mode
*/
it
(
'
getPluralString
_test_003
'
,
0
,
async
function
(
done
)
{
it
(
'
getPluralString
Value_test_001
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getPluralStringValue
({
bundleName
:
"
ohos.intl.test
"
,
moduleName
:
"
entry
"
,
id
:
$r
(
app
.
plural
.
plural_name
).
id
},
1
,
(
error
,
value
)
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getPluralString
_test_003
'
+
value
);
console
.
log
(
'
getPluralString
Value_test_001
'
+
value
);
expect
(
value
).
assertEqual
(
'
1 test other
'
);
})
})
...
...
@@ -618,13 +860,13 @@ describe('resMgrTest', function () {
* @tc.name test getPluralString method with resource param in promise mode
* @tc.desc get the plural string in promise mode
*/
it
(
'
getPluralString
_test_004
'
,
0
,
async
function
(
done
)
{
it
(
'
getPluralString
Value_test_002
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getPluralStringValue
({
bundleName
:
"
ohos.intl.test
"
,
moduleName
:
"
entry
"
,
id
:
$r
(
app
.
plural
.
plural_name
).
id
},
1
).
then
(
value
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getPluralString
_test_004
'
+
value
);
console
.
log
(
'
getPluralString
Value_test_002
'
+
value
);
expect
(
value
).
assertEqual
(
'
1 test other
'
);
})
})
...
...
@@ -636,11 +878,11 @@ describe('resMgrTest', function () {
* @tc.name test getPluralString method in callback mode
* @tc.desc get the plural string in callback mode
*/
it
(
'
getPluralString
_test_005
'
,
0
,
async
function
(
done
)
{
it
(
'
getPluralString
Value_test_003
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getPluralStringValue
(
$r
(
app
.
plural
.
plural_name
).
id
,
1
,
(
error
,
value
)
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getPluralString
_test_005
'
+
value
);
console
.
log
(
'
getPluralString
Value_test_003
'
+
value
);
expect
(
value
).
assertEqual
(
'
1 test other
'
);
})
})
...
...
@@ -652,33 +894,17 @@ describe('resMgrTest', function () {
* @tc.name test getPluralString method in promise mode
* @tc.desc get the plural string in promise mode
*/
it
(
'
getPluralString
_test_006
'
,
0
,
async
function
(
done
)
{
it
(
'
getPluralString
Value_test_004
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getPluralStringValue
(
$r
(
app
.
plural
.
plural_name
).
id
,
1
).
then
(
value
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getPluralString
_test_006
'
+
value
);
console
.
log
(
'
getPluralString
Value_test_004
'
+
value
);
expect
(
value
).
assertEqual
(
'
1 test other
'
);
})
})
done
();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_1900
* @tc.name test getString method in callback mode
* @tc.desc get the string in callback mode
*/
it
(
'
getString_test_005
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getString
(
$r
(
app
.
string
.
mainability_description
).
id
,
(
err
,
value
)
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getString_test_005
'
+
value
);
expect
(
value
).
assertEqual
(
'
JS_Phone_Empty Feature Ability
'
);
})
})
done
();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_1700
* @tc.name test getRawFile method in callback mode
...
...
@@ -714,11 +940,11 @@ describe('resMgrTest', function () {
* @tc.name test getRawFile method in callback mode
* @tc.desc get the getRawFile in callback mode
*/
it
(
'
getRawFile
_test_003
'
,
0
,
async
function
(
done
)
{
it
(
'
getRawFile
Content_test_001
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getRawFileContent
(
'
rawfile/rawfiletest.xml
'
,
(
error
,
value
)
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getRawFile
_test_003
'
+
value
);
console
.
log
(
'
getRawFile
Content_test_001
'
+
value
);
})
})
done
();
...
...
@@ -729,11 +955,11 @@ describe('resMgrTest', function () {
* @tc.name test getRawFile method in promise mode
* @tc.desc get the getRawFile in promise mode
*/
it
(
'
getRawFile
_test_004
'
,
0
,
async
function
(
done
)
{
it
(
'
getRawFile
Content_test_002
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getRawFileContent
(
'
rawfile/rawfiletest.xml
'
).
then
(
value
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getRawFile
_test_004
'
+
value
);
console
.
log
(
'
getRawFile
Content_test_002
'
+
value
);
})
})
done
();
...
...
@@ -802,14 +1028,14 @@ describe('resMgrTest', function () {
* @tc.name test getRawFileDescriptor method in callback mode
* @tc.desc get the RawFileDescriptor in callback mode
*/
it
(
'
getRawF
ileDescriptor_test_003
'
,
0
,
async
function
(
done
)
{
it
(
'
getRawF
d_test_001
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getRawFd
(
'
rawfiletest.xml
'
,
(
error
,
rawfile
)
=>
{
let
fdValue
=
rawfile
.
fd
;
let
offsetValue
=
rawfile
.
offset
;
let
lengthValue
=
rawfile
.
length
;
expect
(
rawfile
!==
null
).
assertTrue
();
console
.
log
(
'
getRawF
ileDescriptor_test_003
--
'
console
.
log
(
'
getRawF
d_test_001
--
'
+
'
fd:
'
+
fdValue
+
'
offset:
'
+
offsetValue
+
'
length:
'
+
lengthValue
);
...
...
@@ -823,15 +1049,15 @@ describe('resMgrTest', function () {
* @tc.name test getRawFileDescriptor method in promise mode
* @tc.desc get the RawFileDescriptor in promise mode
*/
it
(
'
getRawF
ileDescriptor_test_004
'
,
0
,
async
function
(
done
)
{
it
(
'
getRawF
d_test_002
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getRawFd
(
'
rawfiletest.xml
'
).
then
(
rawfile
=>
{
rawfile
.
fd
=
2000
;
rawfile
.
offset
=
20
;
rawfile
.
length
=
200
;
expect
(
rawfile
!==
null
).
assertTrue
();
console
.
log
(
'
getRawF
ileDescriptor_test_004
--
'
+
rawfile
);
console
.
log
(
'
getRawF
ileDescriptor_test_004
--
'
console
.
log
(
'
getRawF
d_test_002
--
'
+
rawfile
);
console
.
log
(
'
getRawF
d_test_002
--
'
+
'
fd:
'
+
rawfile
.
fd
+
'
offset:
'
+
rawfile
.
offset
+
'
length:
'
+
rawfile
.
length
);
...
...
@@ -875,11 +1101,11 @@ describe('resMgrTest', function () {
* @tc.name test closeRawFileDescriptor method in callback mode
* @tc.desc get the closeRawFileDescriptor in callback mode
*/
it
(
'
closeRawF
ileDescriptor_test_003
'
,
0
,
async
function
(
done
)
{
it
(
'
closeRawF
d_test_001
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
closeRawFd
(
'
rawfiletest.xml
'
,
(
error
,
value
)
=>
{
expect
(
error
==
null
).
assertTrue
();
console
.
log
(
'
closeRawF
ileDescriptor_test_003
--
'
+
error
);
console
.
log
(
'
closeRawF
d_test_001
--
'
+
error
);
})
})
done
();
...
...
@@ -890,11 +1116,11 @@ describe('resMgrTest', function () {
* @tc.name test closeRawFileDescriptor method in promise mode
* @tc.desc get the closeRawFileDescriptor in promise mode
*/
it
(
'
closeRawF
ileDescriptor_test_004
'
,
0
,
async
function
(
done
)
{
it
(
'
closeRawF
d_test_002
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
closeRawFd
(
'
rawfiletest.xml
'
).
then
(
value
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
closeRawF
ileDescriptor_test_004
--
'
+
value
);
console
.
log
(
'
closeRawF
d_test_002
--
'
+
value
);
})
})
done
();
...
...
global/resmgr_standard/resmgrjs/src/main/resources/base/element/string.json
浏览文件 @
92ef7094
...
...
@@ -7,22 +7,30 @@
{
"name"
:
"mainability_description"
,
"value"
:
"JS_Phone_Empty Feature Ability"
},
},
{
"name"
:
"MainAbility_desc"
,
"value"
:
"description"
},
{
{
"name"
:
"MainAbility_label"
,
"value"
:
"label"
},
{
{
"name"
:
"TestAbility_desc"
,
"value"
:
"description"
},
{
{
"name"
:
"TestAbility_label"
,
"value"
:
"label"
},
{
"name"
:
"Test_name1"
,
"value"
:
"$string:Test_name2"
},
{
"name"
:
"Test_name2"
,
"value"
:
"$string:Test_name1"
}
]
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录