Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
96678c19
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看板
未验证
提交
96678c19
编写于
11月 17, 2022
作者:
O
openharmony_ci
提交者:
Gitee
11月 17, 2022
浏览文件
操作
浏览文件
下载
差异文件
!6531 match timezone modify
Merge pull request !6531 from 杨清/1228
上级
d0906fbd
a6f7994c
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
567 addition
and
255 deletion
+567
-255
global/i18n_standard/intljs/src/main/js/test/Lang.test.js
global/i18n_standard/intljs/src/main/js/test/Lang.test.js
+7
-6
global/resmgr_standard/resmgrjs/src/main/js/test/Resmgr.test.js
.../resmgr_standard/resmgrjs/src/main/js/test/Resmgr.test.js
+424
-214
global/resmgr_standard/resmgrjs/src/main/resources/base/element/boolean.json
...ard/resmgrjs/src/main/resources/base/element/boolean.json
+8
-0
global/resmgr_standard/resmgrjs/src/main/resources/base/element/plural.json
...dard/resmgrjs/src/main/resources/base/element/plural.json
+26
-0
global/resmgr_standard/resmgrjs/src/main/resources/base/element/strarray.json
...rd/resmgrjs/src/main/resources/base/element/strarray.json
+8
-0
global/resmgr_standard/resmgrjs/src/main/resources/base/element/string.json
...dard/resmgrjs/src/main/resources/base/element/string.json
+35
-35
global/resmgr_standard/resmgrjs/src/main/resources/base/element/theme.json
...ndard/resmgrjs/src/main/resources/base/element/theme.json
+59
-0
未找到文件。
global/i18n_standard/intljs/src/main/js/test/Lang.test.js
浏览文件 @
96678c19
...
...
@@ -148,14 +148,15 @@ describe('LangTest', function () {
let
list
=
I18n
.
getPreferredLanguageList
();
console
.
log
(
'
i18n_test_preferredlanguage_0120
'
+
list
);
expect
(
list
.
length
).
assertLarger
(
0
);
if
(
list
[
0
]
!=
'
zh-Hans-CN
'
){
if
(
list
[
0
]
!=
'
zh-Hans-CN
'
&&
list
[
0
]
!=
'
zh-Hans
'
){
let
value
=
I18n
.
addPreferredLanguage
(
'
zh-Hans-CN
'
);
console
.
log
(
'
i18n_test_preferredlanguage_0120
'
+
value
);
expect
(
value
).
assertTrue
();
expect
(
list
.
length
>
0
).
assertTrue
();
}
else
{
let
value
=
I18n
.
addPreferredLanguage
(
'
en-Latn-US
'
);
console
.
log
(
'
i18n_test_preferredlanguage_0120
'
+
value
);
expect
(
list
.
length
>
0
).
assertTrue
();
}
console
.
log
(
'
i18n_test_preferredlanguage_0120
'
+
I18n
.
getPreferredLanguageList
());
})
...
...
@@ -281,7 +282,7 @@ describe('LangTest', function () {
let
timezone
=
I18n
.
getTimeZone
();
let
value
=
timezone
.
getDisplayName
();
console
.
log
(
'
timezone_test_0200
'
+
value
);
expect
(
value
==
'
GMT
'
||
value
==
'
中国标准时间
'
||
value
==
'
格林尼治标准时间
'
).
assertTrue
();
expect
(
value
.
length
>
0
).
assertTrue
();
})
/* *
...
...
@@ -294,7 +295,7 @@ describe('LangTest', function () {
let
timezone
=
I18n
.
getTimeZone
();
let
value
=
timezone
.
getDisplayName
(
'
zh-CN
'
);
console
.
log
(
'
timezone_test_0300
'
+
value
);
expect
(
value
==
'
GMT
'
||
value
==
'
中国标准时间
'
||
value
==
'
格林尼治标准时间
'
).
assertTrue
();
expect
(
value
.
length
>
0
).
assertTrue
();
})
/* *
...
...
@@ -307,7 +308,7 @@ describe('LangTest', function () {
let
timezone
=
I18n
.
getTimeZone
();
let
value
=
timezone
.
getDisplayName
(
true
);
console
.
log
(
'
timezone_test_0400
'
+
value
);
expect
(
value
==
'
GMT
'
||
value
==
'
中国标准时间
'
||
value
==
'
格林尼治标准时间
'
).
assertTrue
();
expect
(
value
.
length
>
0
).
assertTrue
();
})
/* *
...
...
@@ -320,7 +321,7 @@ describe('LangTest', function () {
let
timezone
=
I18n
.
getTimeZone
();
let
value
=
timezone
.
getDisplayName
(
false
);
console
.
log
(
'
timezone_test_0500
'
+
value
);
expect
(
value
==
'
GMT
'
||
value
==
'
中国标准时间
'
||
value
==
'
格林尼治标准时间
'
).
assertTrue
();
expect
(
value
.
length
>
0
).
assertTrue
();
})
/* *
...
...
global/resmgr_standard/resmgrjs/src/main/js/test/Resmgr.test.js
浏览文件 @
96678c19
...
...
@@ -27,8 +27,8 @@ describe('resMgrTest', function () {
it
(
'
getResourceManager_test_001
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
expect
(
mgr
!==
null
).
assertTrue
();
done
();
})
done
();
})
/* *
...
...
@@ -37,10 +37,10 @@ describe('resMgrTest', function () {
* @tc.desc get the resource manager in callback mode with bundlename
*/
it
(
'
getResourceManager_test_002
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
(
'
com.ohos.contacts
'
,
(
error
,
mgr
)
=>
{
resmgr
.
getResourceManager
(
'
ohos.intl.test
'
,
(
error
,
mgr
)
=>
{
expect
(
mgr
!==
null
).
assertTrue
();
done
();
})
done
();
})
/* *
...
...
@@ -51,8 +51,8 @@ describe('resMgrTest', function () {
it
(
'
getResourceManager_test_003
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
().
then
(
mgr
=>
{
expect
(
mgr
!==
null
).
assertTrue
();
done
();
})
done
();
})
/* *
...
...
@@ -61,10 +61,10 @@ describe('resMgrTest', function () {
* @tc.desc get the resource manager in promise mode with bundlename
*/
it
(
'
getResourceManager_test_004
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
(
'
com.ohos.contacts
'
).
then
(
mgr
=>
{
resmgr
.
getResourceManager
(
'
ohos.intl.test
'
).
then
(
mgr
=>
{
expect
(
mgr
!==
null
).
assertTrue
();
done
();
})
done
();
})
/* *
...
...
@@ -74,13 +74,13 @@ describe('resMgrTest', function () {
*/
it
(
'
getString_test_001
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getString
(
$r
(
app
.
string
.
app_name
).
id
,
(
err
,
value
)
=>
{
mgr
.
getString
(
0x01000008
,
(
err
,
value
)
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getString_test_001
'
+
value
);
expect
(
value
).
assertEqual
(
'
L2Test
'
);
done
();
})
})
done
();
})
/* *
...
...
@@ -90,13 +90,13 @@ describe('resMgrTest', function () {
*/
it
(
'
getString_test_002
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getString
(
$r
(
app
.
string
.
app_name
).
id
).
then
(
value
=>
{
mgr
.
getString
(
0x01000008
).
then
(
value
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getString_test_002
'
+
value
);
expect
(
value
).
assertEqual
(
'
L2Test
'
);
done
();
})
})
done
();
})
/* *
...
...
@@ -106,13 +106,13 @@ describe('resMgrTest', function () {
*/
it
(
'
getString_test_003
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getString
(
$r
(
app
.
string
.
mainability_description
).
id
,
(
err
,
value
)
=>
{
mgr
.
getString
(
0x01000009
,
(
err
,
value
)
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getString_test_003
'
+
value
);
expect
(
value
).
assertEqual
(
'
JS_Phone_Empty Feature Ability
'
);
done
();
})
})
done
();
})
/* *
...
...
@@ -123,14 +123,13 @@ describe('resMgrTest', function () {
it
(
'
getStringValue_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
)
=>
{
moduleName
:
"
entry
"
,
id
:
0x01000008
},
(
err
,
value
)
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getStringValue_test_001
'
+
value
);
expect
(
value
).
assertEqual
(
'
L2Test
'
);
done
(
);
})
})
done
();
})
/* *
...
...
@@ -140,12 +139,13 @@ describe('resMgrTest', function () {
*/
it
(
'
getStringValue_test_002
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
console
.
info
(
`getStringValue_test_002
${
JSON
.
stringify
(
mgr
)}
`
)
mgr
.
getStringValue
({
bundleName
:
"
ohos.intl.test
"
,
moduleName
:
"
entry
"
,
id
:
$r
(
app
.
string
.
app_name
).
id
}).
then
(
value
=>
{
moduleName
:
"
entry
"
,
id
:
0x01000008
}).
then
(
value
=>
{
console
.
info
(
`getStringValue_test_002 promise
${
JSON
.
stringify
(
error
)}
`
)
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getStringValue_test_002
'
+
value
);
expect
(
value
).
assertEqual
(
'
L2Test
'
);
})
})
done
();
...
...
@@ -158,13 +158,13 @@ describe('resMgrTest', function () {
*/
it
(
'
getStringValue_test_003
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getStringValue
(
$r
(
app
.
string
.
app_name
).
id
,
(
err
,
value
)
=>
{
mgr
.
getStringValue
(
0x01000008
,
(
err
,
value
)
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getStringValue_test_003
'
+
value
);
expect
(
value
).
assertEqual
(
'
L2Test
'
);
done
();
})
})
done
();
})
/* *
...
...
@@ -174,13 +174,13 @@ describe('resMgrTest', function () {
*/
it
(
'
getStringValue_test_004
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getStringValue
(
$r
(
app
.
string
.
app_name
).
id
).
then
(
value
=>
{
mgr
.
getStringValue
(
0x01000008
).
then
(
value
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getStringValue_test_004
'
+
value
);
expect
(
value
).
assertEqual
(
'
L2Test
'
);
done
();
})
})
done
();
})
/* *
...
...
@@ -334,12 +334,15 @@ describe('resMgrTest', function () {
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
try
{
// 0x01000000 id is integer resource,throw 9001002 error code
console
.
log
(
'
getStringValue_test_010 promise start
'
);
mgr
.
getStringValue
(
0x01000000
).
then
(
value
=>
{
console
.
log
(
'
getStringValue_test_010 promise try
'
+
value
);
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getStringValue_test_010
'
+
value
);
expect
(
value
).
assertEqual
(
'
L2Test
'
);
done
();
}).
catch
(
error
=>
{
console
.
log
(
'
getStringValue_test_010 promise catch
'
);
console
.
log
(
'
getStringValue_test_010 error.code
'
+
error
.
code
);
console
.
log
(
'
getStringValue_test_010 error.message
'
+
error
.
message
);
expect
(
error
.
code
==
9001002
).
assertTrue
();
...
...
@@ -350,6 +353,7 @@ describe('resMgrTest', function () {
console
.
log
(
'
getStringValue_test_010 err.message
'
+
err
.
message
);
done
();
}
console
.
log
(
'
getStringValue_test_010 promise end
'
);
})
})
...
...
@@ -416,7 +420,7 @@ describe('resMgrTest', function () {
*/
it
(
'
getStringArray_test_001
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getStringArray
(
$r
(
app
.
strarray
.
sizeList
).
id
,
(
err
,
value
)
=>
{
mgr
.
getStringArray
(
0x0100000a
,
(
err
,
value
)
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getStringArray_test_001
'
+
value
);
console
.
log
(
'
getStringArray_test_001
'
+
value
.
length
);
...
...
@@ -426,9 +430,9 @@ describe('resMgrTest', function () {
expect
(
value
[
1
]).
assertEqual
(
'
middle
'
);
expect
(
value
[
2
]).
assertEqual
(
'
large
'
);
expect
(
value
[
3
]).
assertEqual
(
'
extra large
'
);
done
();
})
})
done
();
})
/* *
...
...
@@ -438,7 +442,7 @@ describe('resMgrTest', function () {
*/
it
(
'
getStringArray_test_002
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getStringArray
(
$r
(
app
.
strarray
.
sizeList
).
id
).
then
(
value
=>
{
mgr
.
getStringArray
(
0x0100000a
).
then
(
value
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getStringArray_test_002
'
+
value
);
console
.
log
(
'
getStringArray_test_002
'
+
value
.
length
);
...
...
@@ -448,9 +452,9 @@ describe('resMgrTest', function () {
expect
(
value
[
1
]).
assertEqual
(
'
middle
'
);
expect
(
value
[
2
]).
assertEqual
(
'
large
'
);
expect
(
value
[
3
]).
assertEqual
(
'
extra large
'
);
done
();
})
})
done
();
})
/* *
...
...
@@ -461,20 +465,13 @@ describe('resMgrTest', function () {
it
(
'
getStringArrayValue_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
)
=>
{
moduleName
:
"
entry
"
,
id
:
0x0100000a
},
(
err
,
value
)
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getStringArrayValue_test_001
'
+
value
);
console
.
log
(
'
getStringArrayValue_test_001
'
+
value
.
length
);
console
.
log
(
'
getStringArrayValue_test_001
'
+
value
[
0
]);
expect
(
value
.
length
).
assertEqual
(
4
);
expect
(
value
[
0
]).
assertEqual
(
'
small
'
);
expect
(
value
[
1
]).
assertEqual
(
'
middle
'
);
expect
(
value
[
2
]).
assertEqual
(
'
large
'
);
expect
(
value
[
3
]).
assertEqual
(
'
extra large
'
);
done
();
})
})
done
();
})
/* *
...
...
@@ -484,18 +481,11 @@ describe('resMgrTest', function () {
*/
it
(
'
getStringArrayValue_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
=>
{
mgr
.
getStringArrayValue
({
bundleName
:
"
ohos.intl.test
"
,
moduleName
:
"
entry
"
,
id
:
0x0100000a
}).
then
(
value
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getStringArrayValue_test_002
'
+
value
);
console
.
log
(
'
getStringArrayValue_test_002
'
+
value
.
length
);
console
.
log
(
'
getStringArrayValue_test_002
'
+
value
[
0
]);
expect
(
value
.
length
).
assertEqual
(
4
);
expect
(
value
[
0
]).
assertEqual
(
'
small
'
);
expect
(
value
[
1
]).
assertEqual
(
'
middle
'
);
expect
(
value
[
2
]).
assertEqual
(
'
large
'
);
expect
(
value
[
3
]).
assertEqual
(
'
extra large
'
);
})
})
done
();
...
...
@@ -508,7 +498,7 @@ describe('resMgrTest', function () {
*/
it
(
'
getStringArrayValue_test_003
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getStringArrayValue
(
$r
(
app
.
strarray
.
sizeList
).
id
,
(
err
,
value
)
=>
{
mgr
.
getStringArrayValue
(
0x0100000a
,
(
err
,
value
)
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getStringArrayValue_test_003
'
+
value
);
console
.
log
(
'
getStringArrayValue_test_003
'
+
value
.
length
);
...
...
@@ -518,9 +508,9 @@ describe('resMgrTest', function () {
expect
(
value
[
1
]).
assertEqual
(
'
middle
'
);
expect
(
value
[
2
]).
assertEqual
(
'
large
'
);
expect
(
value
[
3
]).
assertEqual
(
'
extra large
'
);
done
();
})
})
done
();
})
/* *
...
...
@@ -530,7 +520,7 @@ describe('resMgrTest', function () {
*/
it
(
'
getStringArrayValue_test_004
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getStringArrayValue
(
$r
(
app
.
strarray
.
sizeList
).
id
).
then
(
value
=>
{
mgr
.
getStringArrayValue
(
0x0100000a
).
then
(
value
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getStringArrayValue_test_004
'
+
value
);
console
.
log
(
'
getStringArrayValue_test_004
'
+
value
.
length
);
...
...
@@ -540,9 +530,9 @@ describe('resMgrTest', function () {
expect
(
value
[
1
]).
assertEqual
(
'
middle
'
);
expect
(
value
[
2
]).
assertEqual
(
'
large
'
);
expect
(
value
[
3
]).
assertEqual
(
'
extra large
'
);
done
();
})
})
done
();
})
/* *
...
...
@@ -552,12 +542,13 @@ describe('resMgrTest', function () {
*/
it
(
'
getMedia_test_001
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getMedia
(
$r
(
app
.
media
.
icon
).
id
,
(
err
,
value
)
=>
{
mgr
.
getMedia
(
0x01000017
,
(
err
,
value
)
=>
{
console
.
log
(
'
getMedia_test_001
'
+
value
.
length
);
expect
(
value
.
length
>
0
).
assertTrue
();
done
();
})
})
done
();
})
/* *
...
...
@@ -567,12 +558,12 @@ describe('resMgrTest', function () {
*/
it
(
'
getMedia_test_002
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getMedia
(
$r
(
app
.
media
.
icon
).
id
).
then
(
value
=>
{
mgr
.
getMedia
(
0x01000017
).
then
(
value
=>
{
console
.
log
(
'
getMedia_test_002
'
+
value
.
length
);
expect
(
value
.
length
>
0
).
assertTrue
();
done
();
})
})
done
();
})
/* *
...
...
@@ -583,13 +574,13 @@ describe('resMgrTest', function () {
it
(
'
getMediaContent_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
(
'
getMediaContent_test_001
'
+
value
.
length
);
expect
(
value
.
length
>
0
).
assertTrue
();
moduleName
:
"
entry
"
,
id
:
0x01000017
},
(
err
,
value
)
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getMediaContent_test_001
'
+
value
);
done
();
})
})
done
();
})
/* *
...
...
@@ -600,10 +591,10 @@ describe('resMgrTest', function () {
it
(
'
getMediaContent_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
(
'
getMediaContent_test_002
'
+
value
.
length
);
expect
(
value
.
length
>
0
).
assertTrue
(
);
moduleName
:
"
entry
"
,
id
:
0x01000017
}).
then
(
value
=>
{
expect
(
value
!==
null
).
assertTrue
(
);
console
.
log
(
'
getMediaContent_test_002
'
+
value
);
})
})
done
();
...
...
@@ -616,12 +607,12 @@ describe('resMgrTest', function () {
*/
it
(
'
getMediaContent_test_003
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getMediaContent
(
$r
(
app
.
media
.
icon
).
id
,
(
err
,
value
)
=>
{
mgr
.
getMediaContent
(
0x01000017
,
(
err
,
value
)
=>
{
console
.
log
(
'
getMediaContent_test_003
'
+
value
.
length
);
expect
(
value
.
length
>
0
).
assertTrue
();
done
();
})
})
done
();
})
/* *
...
...
@@ -631,12 +622,12 @@ describe('resMgrTest', function () {
*/
it
(
'
getMediaContent_test_004
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getMediaContent
(
$r
(
app
.
media
.
icon
).
id
).
then
(
value
=>
{
mgr
.
getMediaContent
(
0x01000017
).
then
(
value
=>
{
console
.
log
(
'
getMediaContent_test_004
'
+
value
.
length
);
expect
(
value
.
length
>
0
).
assertTrue
();
done
();
})
})
done
();
})
/* *
...
...
@@ -646,12 +637,12 @@ describe('resMgrTest', function () {
*/
it
(
'
getMediaBase64_test_001
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getMediaBase64
(
$r
(
app
.
media
.
icon
).
id
,
(
err
,
value
)
=>
{
mgr
.
getMediaBase64
(
0x01000017
,
(
err
,
value
)
=>
{
expect
(
value
.
length
>
0
).
assertTrue
();
console
.
log
(
'
getMediaBase64_test_001
'
+
value
);
done
();
})
})
done
();
})
/* *
...
...
@@ -661,12 +652,12 @@ describe('resMgrTest', function () {
*/
it
(
'
getMediaBase64_test_002
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getMediaBase64
(
$r
(
app
.
media
.
icon
).
id
).
then
(
value
=>
{
mgr
.
getMediaBase64
(
0x01000017
).
then
(
value
=>
{
expect
(
value
.
length
>
0
).
assertTrue
();
console
.
log
(
'
getMediaBase64_test_002
'
+
value
);
done
();
})
})
done
();
})
/* *
...
...
@@ -677,13 +668,13 @@ describe('resMgrTest', function () {
it
(
'
getMediaContentBase64_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
();
moduleName
:
"
entry
"
,
id
:
0x01000017
},
(
err
,
value
)
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getMediaContentBase64_test_001
'
+
value
);
done
();
})
})
done
();
})
/* *
...
...
@@ -694,9 +685,9 @@ describe('resMgrTest', function () {
it
(
'
getMediaContentBase64_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
();
moduleName
:
"
entry
"
,
id
:
0x01000017
}).
then
(
value
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getMediaContentBase64_test_002
'
+
value
);
})
})
...
...
@@ -710,12 +701,12 @@ describe('resMgrTest', function () {
*/
it
(
'
getMediaContentBase64_test_003
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getMediaContentBase64
(
$r
(
app
.
media
.
icon
).
id
,
(
err
,
value
)
=>
{
mgr
.
getMediaContentBase64
(
0x01000017
,
(
err
,
value
)
=>
{
expect
(
value
.
length
>
0
).
assertTrue
();
console
.
log
(
'
getMediaContentBase64_test_003
'
+
value
);
done
();
})
})
done
();
})
/* *
...
...
@@ -725,12 +716,12 @@ describe('resMgrTest', function () {
*/
it
(
'
getMediaContentBase64_test_004
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getMediaContentBase64
(
$r
(
app
.
media
.
icon
).
id
).
then
(
value
=>
{
mgr
.
getMediaContentBase64
(
0x01000017
).
then
(
value
=>
{
expect
(
value
.
length
>
0
).
assertTrue
();
console
.
log
(
'
getMediaContentBase64_test_004
'
+
value
);
done
();
})
})
done
();
})
/* *
...
...
@@ -740,13 +731,22 @@ describe('resMgrTest', function () {
*/
it
(
'
getConfiguration_test_001
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
console
.
log
(
'
getConfiguration_test_001 0
'
);
mgr
.
getConfiguration
((
error
,
cfg
)
=>
{
cfg
.
direction
=
Direction
.
DIRECTION_VERTICAL
;
cfg
.
locale
=
'
zh
'
;
console
.
log
(
'
getConfiguration_test_001 1
'
);
console
.
log
(
'
getConfiguration_test_001 1
'
+
cfg
.
direction
);
console
.
log
(
'
getConfiguration_test_001 1
'
+
resmgr
.
Direction
.
DIRECTION_HORIZONTAL
);
console
.
log
(
'
getConfiguration_test_001 11
'
);
if
(
cfg
.
direction
==
resmgr
.
Direction
.
DIRECTION_HORIZONTAL
){
console
.
log
(
'
getConfiguration_test_001 DIRECTION_HORIZONTAL
'
);
}
else
if
(
cfg
.
direction
==
resmgr
.
Direction
.
DIRECTION_HORIZONTAL
){
console
.
log
(
'
getConfiguration_test_001 DIRECTION_HORIZONTAL
'
);
}
expect
(
cfg
!==
null
).
assertTrue
();
console
.
log
(
'
getConfiguration_test_001
'
+
JSON
.
stringify
(
cfg
));
done
();
})
})
done
();
})
/* *
...
...
@@ -755,12 +755,21 @@ describe('resMgrTest', function () {
* @tc.desc get the configuration in promise mode
*/
it
(
'
getConfiguration_test_002
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getConfiguration
().
then
(
cfg
=>
{
expect
(
cfg
!==
null
).
assertTrue
();
cfg
.
direction
=
Direction
.
DIRECTION_HORIZONTAL
;
})
})
console
.
log
(
'
getConfiguration_test_002 0
'
);
expect
(
resmgr
.
Direction
.
DIRECTION_HORIZONTAL
).
assertEqual
(
1
);
console
.
log
(
'
getConfiguration_test_002 1
'
);
done
();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_1400
* @tc.name test getConfiguration method in promise mode
* @tc.desc get the configuration in promise mode
*/
it
(
'
getConfiguration_test_003
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
getConfiguration_test_003 0
'
);
expect
(
resmgr
.
Direction
.
DIRECTION_VERTICAL
).
assertEqual
(
0
);
console
.
log
(
'
getConfiguration_test_003 1
'
);
done
();
})
...
...
@@ -772,16 +781,24 @@ describe('resMgrTest', function () {
it
(
'
getDeviceCapability_test_001
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getDeviceCapability
((
error
,
dc
)
=>
{
dc
.
screenDensity
=
ScreenDensity
.
SCREEN_SDPI
;
dc
.
deviceType
=
DeviceType
.
DEVICE_TYPE_PHONE
;
dc
.
screenDensity
=
ScreenDensity
.
SCREEN_MDPI
;
dc
.
deviceType
=
DeviceType
.
DEVICE_TYPE_CAR
;
dc
.
screenDensity
=
ScreenDensity
.
SCREEN_LDPI
;
dc
.
deviceType
=
DeviceType
.
DEVICE_TYPE_TV
;
if
(
dc
.
deviceType
==
resmgr
.
DeviceType
.
DEVICE_TYPE_PHONE
){
console
.
log
(
'
getDeviceCapability_test_001 DEVICE_TYPE_PHONE
'
);
}
else
if
(
dc
.
deviceType
==
resmgr
.
DeviceType
.
DEVICE_TYPE_TABLET
){
console
.
log
(
'
getDeviceCapability_test_001 DEVICE_TYPE_TABLET
'
);
}
else
if
(
dc
.
deviceType
==
resmgr
.
DeviceType
.
DEVICE_TYPE_CAR
){
console
.
log
(
'
getDeviceCapability_test_001 DEVICE_TYPE_CAR
'
);
}
else
if
(
dc
.
deviceType
==
resmgr
.
DeviceType
.
DEVICE_TYPE_PC
){
console
.
log
(
'
getDeviceCapability_test_001 DEVICE_TYPE_PC
'
);
}
else
if
(
dc
.
deviceType
==
resmgr
.
DeviceType
.
DEVICE_TYPE_TV
){
console
.
log
(
'
getDeviceCapability_test_001 DEVICE_TYPE_TV
'
);
}
else
if
(
dc
.
deviceType
==
resmgr
.
DeviceType
.
DEVICE_TYPE_WEARABLE
){
console
.
log
(
'
getDeviceCapability_test_001 DEVICE_TYPE_WEARABLE
'
);
}
expect
(
dc
!==
null
).
assertTrue
();
console
.
log
(
'
getDeviceCapability_test_001
'
+
JSON
.
stringify
(
dc
));
done
();
})
})
done
();
})
/* *
...
...
@@ -790,18 +807,181 @@ describe('resMgrTest', function () {
* @tc.desc get the device capability in promise mode
*/
it
(
'
getDeviceCapability_test_002
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
getDeviceCapability_test_002 0
'
);
expect
(
resmgr
.
DeviceType
.
DEVICE_TYPE_PHONE
).
assertEqual
(
0
);
console
.
log
(
'
getDeviceCapability_test_002 1
'
);
done
();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_1600
* @tc.name test getDeviceCapability method in promise mode
* @tc.desc get the device capability in promise mode
*/
it
(
'
getDeviceCapability_test_003
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
getDeviceCapability_test_003 0
'
);
expect
(
resmgr
.
DeviceType
.
DEVICE_TYPE_TABLET
).
assertEqual
(
1
);
console
.
log
(
'
getDeviceCapability_test_003 1
'
);
done
();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_1600
* @tc.name test getDeviceCapability method in promise mode
* @tc.desc get the device capability in promise mode
*/
it
(
'
getDeviceCapability_test_004
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
getDeviceCapability_test_004 0
'
);
expect
(
resmgr
.
DeviceType
.
DEVICE_TYPE_CAR
).
assertEqual
(
2
);
console
.
log
(
'
getDeviceCapability_test_004 1
'
);
done
();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_1600
* @tc.name test getDeviceCapability method in promise mode
* @tc.desc get the device capability in promise mode
*/
it
(
'
getDeviceCapability_test_005
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
getDeviceCapability_test_005 0
'
);
expect
(
resmgr
.
DeviceType
.
DEVICE_TYPE_PC
).
assertEqual
(
3
);
console
.
log
(
'
getDeviceCapability_test_005 1
'
);
done
();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_1600
* @tc.name test getDeviceCapability method in promise mode
* @tc.desc get the device capability in promise mode
*/
it
(
'
getDeviceCapability_test_006
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
getDeviceCapability_test_006 0
'
);
expect
(
resmgr
.
DeviceType
.
DEVICE_TYPE_TV
).
assertEqual
(
4
);
console
.
log
(
'
getDeviceCapability_test_006 1
'
);
done
();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_1600
* @tc.name test getDeviceCapability method in promise mode
* @tc.desc get the device capability in promise mode
*/
it
(
'
getDeviceCapability_test_007
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
getDeviceCapability_test_007 0
'
);
expect
(
resmgr
.
DeviceType
.
DEVICE_TYPE_WEARABLE
).
assertEqual
(
6
);
console
.
log
(
'
getDeviceCapability_test_007 1
'
);
done
();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_1500
* @tc.name test getDeviceCapability method in callback mode
* @tc.desc get the device capability in callback mode
*/
it
(
'
getScreenDensity_test_001
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getDeviceCapability
().
then
(
dc
=>
{
dc
.
screenDensity
=
ScreenDensity
.
SCREEN_XLDPI
;
dc
.
deviceType
=
DeviceType
.
DEVICE_TYPE_TABLET
;
dc
.
screenDensity
=
ScreenDensity
.
SCREEN_XXLDPI
;
dc
.
deviceType
=
DeviceType
.
DEVICE_TYPE_WEARABLE
;
dc
.
screenDensity
=
ScreenDensity
.
SCREEN_XXXLDPI
;
dc
.
deviceType
=
DeviceType
.
DEVICE_TYPE_PC
;
mgr
.
getDeviceCapability
((
error
,
dc
)
=>
{
if
(
dc
.
deviceType
==
resmgr
.
ScreenDensity
.
SCREEN_SDPI
){
console
.
log
(
'
getScreenDensity_test_001 SCREEN_SDPI
'
);
}
else
if
(
dc
.
deviceType
==
resmgr
.
ScreenDensity
.
SCREEN_MDPI
){
console
.
log
(
'
getScreenDensity_test_001 SCREEN_MDPI
'
);
}
else
if
(
dc
.
deviceType
==
resmgr
.
ScreenDensity
.
SCREEN_LDPI
){
console
.
log
(
'
getScreenDensity_test_001 SCREEN_LDPI
'
);
}
else
if
(
dc
.
deviceType
==
resmgr
.
ScreenDensity
.
SCREEN_XLDPI
){
console
.
log
(
'
getScreenDensity_test_001 SCREEN_XLDPI
'
);
}
else
if
(
dc
.
deviceType
==
resmgr
.
ScreenDensity
.
SCREEN_XXLDPI
){
console
.
log
(
'
getScreenDensity_test_001 SCREEN_XXLDPI
'
);
}
else
if
(
dc
.
deviceType
==
resmgr
.
ScreenDensity
.
SCREEN_XXXLDPI
){
console
.
log
(
'
getScreenDensity_test_001 SCREEN_XXXLDPI
'
);
}
expect
(
dc
!==
null
).
assertTrue
();
console
.
log
(
'
getDeviceCapability_test_002
'
+
dc
);
console
.
log
(
'
getScreenDensity_test_001
'
+
JSON
.
stringify
(
dc
));
done
();
})
})
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_1600
* @tc.name test getDeviceCapability method in promise mode
* @tc.desc get the device capability in promise mode
*/
it
(
'
getScreenDensity_test_002
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
getScreenDensity_test_002 0
'
);
expect
(
resmgr
.
ScreenDensity
.
SCREEN_SDPI
).
assertEqual
(
120
);
console
.
log
(
'
getScreenDensity_test_002 1
'
);
done
();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_1600
* @tc.name test getDeviceCapability method in promise mode
* @tc.desc get the device capability in promise mode
*/
it
(
'
getScreenDensity_test_003
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
getScreenDensity_test_003 0
'
);
expect
(
resmgr
.
ScreenDensity
.
SCREEN_MDPI
).
assertEqual
(
160
);
console
.
log
(
'
getScreenDensity_test_003 1
'
);
done
();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_1600
* @tc.name test getDeviceCapability method in promise mode
* @tc.desc get the device capability in promise mode
*/
it
(
'
getScreenDensity_test_004
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
getScreenDensity_test_004 0
'
);
expect
(
resmgr
.
ScreenDensity
.
SCREEN_LDPI
).
assertEqual
(
240
);
console
.
log
(
'
getScreenDensity_test_004 1
'
);
done
();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_1600
* @tc.name test getDeviceCapability method in promise mode
* @tc.desc get the device capability in promise mode
*/
it
(
'
getScreenDensity_test_005
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
getScreenDensity_test_005 0
'
);
expect
(
resmgr
.
ScreenDensity
.
SCREEN_XLDPI
).
assertEqual
(
320
);
console
.
log
(
'
getScreenDensity_test_005 1
'
);
done
();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_1600
* @tc.name test getDeviceCapability method in promise mode
* @tc.desc get the device capability in promise mode
*/
it
(
'
getScreenDensity_test_006
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
getScreenDensity_test_006 0
'
);
expect
(
resmgr
.
ScreenDensity
.
SCREEN_XXLDPI
).
assertEqual
(
480
);
console
.
log
(
'
getScreenDensity_test_006 1
'
);
done
();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_1600
* @tc.name test getDeviceCapability method in promise mode
* @tc.desc get the device capability in promise mode
*/
it
(
'
getScreenDensity_test_007
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
getScreenDensity_test_007 0
'
);
expect
(
resmgr
.
ScreenDensity
.
SCREEN_XXXLDPI
).
assertEqual
(
640
);
console
.
log
(
'
getScreenDensity_test_007 1
'
);
done
();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_1600
* @tc.name test getDeviceCapability method in promise mode
* @tc.desc get the device capability in promise mode
*/
it
(
'
getScreenDensity_test_002
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
getScreenDensity_test_002 0
'
);
expect
(
resmgr
.
ScreenDensity
.
SCREEN_SDPI
).
assertEqual
(
120
);
console
.
log
(
'
getScreenDensity_test_002 1
'
);
done
();
})
...
...
@@ -812,13 +992,13 @@ describe('resMgrTest', function () {
*/
it
(
'
getPluralString_test_001
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getPluralString
(
$r
(
app
.
plural
.
plural_name
).
id
,
1
,
(
error
,
value
)
=>
{
mgr
.
getPluralString
(
0x01000012
,
1
,
(
error
,
value
)
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getPluralString_test_001
'
+
value
);
expect
(
value
).
assertEqual
(
'
1 test other
'
);
done
();
})
})
done
();
})
/* *
...
...
@@ -828,13 +1008,13 @@ describe('resMgrTest', function () {
*/
it
(
'
getPluralString_test_002
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getPluralString
(
$r
(
app
.
plural
.
plural_name
).
id
,
1
).
then
(
value
=>
{
mgr
.
getPluralString
(
0x01000012
,
1
).
then
(
value
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getPluralString_test_002
'
+
value
);
expect
(
value
).
assertEqual
(
'
1 test other
'
);
done
();
})
})
done
();
})
/* *
...
...
@@ -845,14 +1025,13 @@ describe('resMgrTest', function () {
it
(
'
getPluralStringValue_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
)
=>
{
moduleName
:
"
entry
"
,
id
:
0x01000012
},
1
,
(
error
,
value
)
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getPluralStringValue_test_001
'
+
value
);
expect
(
value
).
assertEqual
(
'
1 test other
'
);
done
(
);
})
})
done
();
})
/* *
...
...
@@ -863,11 +1042,10 @@ describe('resMgrTest', function () {
it
(
'
getPluralStringValue_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
=>
{
moduleName
:
"
entry
"
,
id
:
0x01000012
},
1
).
then
(
value
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getPluralStringValue_test_002
'
+
value
);
expect
(
value
).
assertEqual
(
'
1 test other
'
);
})
})
done
();
...
...
@@ -880,13 +1058,13 @@ describe('resMgrTest', function () {
*/
it
(
'
getPluralStringValue_test_003
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getPluralStringValue
(
$r
(
app
.
plural
.
plural_name
).
id
,
1
,
(
error
,
value
)
=>
{
mgr
.
getPluralStringValue
(
0x01000012
,
1
,
(
error
,
value
)
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getPluralStringValue_test_003
'
+
value
);
expect
(
value
).
assertEqual
(
'
1 test other
'
);
done
();
})
})
done
();
})
/* *
...
...
@@ -896,13 +1074,13 @@ describe('resMgrTest', function () {
*/
it
(
'
getPluralStringValue_test_004
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getPluralStringValue
(
$r
(
app
.
plural
.
plural_name
).
id
,
1
).
then
(
value
=>
{
mgr
.
getPluralStringValue
(
0x01000012
,
1
).
then
(
value
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getPluralStringValue_test_004
'
+
value
);
expect
(
value
).
assertEqual
(
'
1 test other
'
);
done
();
})
})
done
();
})
/* *
...
...
@@ -915,9 +1093,9 @@ describe('resMgrTest', function () {
mgr
.
getRawFile
(
'
rawfile/rawfiletest.xml
'
,
(
error
,
value
)
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getRawFile_test_001
'
+
value
);
done
();
})
})
done
();
})
/* *
...
...
@@ -930,9 +1108,9 @@ describe('resMgrTest', function () {
mgr
.
getRawFile
(
'
rawfile/rawfiletest.xml
'
).
then
(
value
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getRawFile_test_002
'
+
value
);
done
();
})
})
done
();
})
/* *
...
...
@@ -945,9 +1123,9 @@ describe('resMgrTest', function () {
mgr
.
getRawFileContent
(
'
rawfile/rawfiletest.xml
'
,
(
error
,
value
)
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getRawFileContent_test_001
'
+
value
);
done
();
})
})
done
();
})
/* *
...
...
@@ -960,9 +1138,9 @@ describe('resMgrTest', function () {
mgr
.
getRawFileContent
(
'
rawfile/rawfiletest.xml
'
).
then
(
value
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getRawFileContent_test_002
'
+
value
);
done
();
})
})
done
();
})
/* *
...
...
@@ -972,12 +1150,12 @@ describe('resMgrTest', function () {
*/
it
(
'
release_test_001
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getString
(
$r
(
app
.
string
.
app_name
).
id
,
(
err
,
value
)
=>
{
mgr
.
getString
(
0x01000008
,
(
err
,
value
)
=>
{
expect
(
value
!==
null
).
assertTrue
();
done
();
})
mgr
.
release
();
})
done
();
})
/* *
...
...
@@ -993,12 +1171,18 @@ describe('resMgrTest', function () {
let
lengthValue
=
rawfile
.
length
;
expect
(
rawfile
!==
null
).
assertTrue
();
console
.
log
(
'
getRawFileDescriptor_test_001--
'
+
'
fd:
'
+
fdValue
+
'
offset:
'
+
offsetValue
+
'
length:
'
+
lengthValue
);
+
'
fd:
'
+
fdValue
+
'
offset:
'
+
offsetValue
+
'
length:
'
+
lengthValue
);
done
();
})
mgr
.
closeRawFileDescriptor
(
'
rawfiletest.xml
'
,
(
error
,
value
)
=>
{
console
.
log
(
'
getRawFileDescriptor_test_001--start close
'
);
expect
(
error
!==
null
).
assertTrue
();
console
.
log
(
'
getRawFileDescriptor_test_001--
'
+
JSON
.
stringify
(
error
));
done
();
})
})
done
();
})
/* *
...
...
@@ -1018,9 +1202,30 @@ describe('resMgrTest', function () {
+
'
fd:
'
+
rawfile
.
fd
+
'
offset:
'
+
rawfile
.
offset
+
'
length:
'
+
rawfile
.
length
);
done
();
})
mgr
.
closeRawFileDescriptor
(
'
rawfiletest.xml
'
).
then
(
value
=>
{
console
.
log
(
'
getRawFileDescriptor_test_002--start close
'
);
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getRawFileDescriptor_test_002--
'
+
JSON
.
stringify
(
value
));
done
();
})
})
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_2200
* @tc.name test closeRawFileDescriptor method in callback mode
* @tc.desc get the closeRawFileDescriptor in callback mode
*/
it
(
'
closeRawFileDescriptor_test_001
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
closeRawFileDescriptor
(
'
rawfiletest.xml
'
,
(
error
,
value
)
=>
{
expect
(
error
!==
null
).
assertTrue
();
console
.
log
(
'
closeRawFileDescriptor_test_001--
'
+
JSON
.
stringify
(
error
));
done
();
})
})
done
();
})
/* *
...
...
@@ -1036,12 +1241,12 @@ describe('resMgrTest', function () {
let
lengthValue
=
rawfile
.
length
;
expect
(
rawfile
!==
null
).
assertTrue
();
console
.
log
(
'
getRawFd_test_001--
'
+
'
fd:
'
+
fdValue
+
'
offset:
'
+
offsetValue
+
'
length:
'
+
lengthValue
);
+
'
fd:
'
+
fdValue
+
'
offset:
'
+
offsetValue
+
'
length:
'
+
lengthValue
);
done
();
})
})
done
();
})
/* *
...
...
@@ -1056,44 +1261,14 @@ describe('resMgrTest', function () {
rawfile
.
offset
=
20
;
rawfile
.
length
=
200
;
expect
(
rawfile
!==
null
).
assertTrue
();
console
.
log
(
'
getRawFd_test_002--
'
+
rawfile
);
console
.
log
(
'
getRawFd_test_002--
'
+
JSON
.
stringify
(
rawfile
)
);
console
.
log
(
'
getRawFd_test_002--
'
+
'
fd:
'
+
rawfile
.
fd
+
'
offset:
'
+
rawfile
.
offset
+
'
length:
'
+
rawfile
.
length
);
done
();
})
})
done
();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_2200
* @tc.name test closeRawFileDescriptor method in callback mode
* @tc.desc get the closeRawFileDescriptor in callback mode
*/
it
(
'
closeRawFileDescriptor_test_001
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
closeRawFileDescriptor
(
'
rawfiletest.xml
'
,
(
error
,
value
)
=>
{
expect
(
error
!==
null
).
assertTrue
();
console
.
log
(
'
closeRawFileDescriptor_test_001--
'
+
error
);
})
})
done
();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_2300
* @tc.name test closeRawFileDescriptor method in promise mode
* @tc.desc get the closeRawFileDescriptor in promise mode
*/
it
(
'
closeRawFileDescriptor_test_002
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
closeRawFileDescriptor
(
'
rawfiletest.xml
'
).
then
(
value
=>
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
closeRawFileDescriptor_test_002--
'
+
value
);
})
})
done
();
})
/* *
...
...
@@ -1103,12 +1278,24 @@ describe('resMgrTest', function () {
*/
it
(
'
closeRawFd_test_001
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
closeRawFd
(
'
rawfiletest.xml
'
,
(
error
,
value
)
=>
{
expect
(
error
!==
null
).
assertTrue
();
console
.
log
(
'
closeRawFd_test_001--
'
+
error
);
})
try
{
mgr
.
closeRawFd
(
'
notexist.xml
'
,
(
error
,
value
)
=>
{
if
(
error
){
console
.
log
(
'
closeRawFd_test_001 err.code:
'
+
error
.
code
);
console
.
log
(
'
closeRawFd_test_001 err.message:
'
+
error
.
message
);
expect
(
error
.
code
==
9001005
).
assertTrue
();
done
();
}
else
{
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
closeRawFd_test_001
'
+
value
);
done
();
}
})
}
catch
(
e
){
console
.
log
(
'
closeRawFd_test_001 e.code
'
+
e
.
code
);
console
.
log
(
'
closeRawFd_test_001 e.message
'
+
e
.
message
);
}
})
done
();
})
/* *
...
...
@@ -1174,9 +1361,9 @@ describe('resMgrTest', function () {
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getStringByName_test_001
'
+
value
);
expect
(
value
).
assertEqual
(
'
L2Test
'
);
done
();
})
})
done
();
})
/* *
...
...
@@ -1190,9 +1377,9 @@ describe('resMgrTest', function () {
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getStringByName_test_002
'
+
value
);
expect
(
value
).
assertEqual
(
'
L2Test
'
);
done
();
})
})
done
();
})
/* *
...
...
@@ -1212,9 +1399,9 @@ describe('resMgrTest', function () {
expect
(
value
[
1
]).
assertEqual
(
'
middle
'
);
expect
(
value
[
2
]).
assertEqual
(
'
large
'
);
expect
(
value
[
3
]).
assertEqual
(
'
extra large
'
);
done
();
})
})
done
();
})
/* *
...
...
@@ -1234,9 +1421,9 @@ describe('resMgrTest', function () {
expect
(
value
[
1
]).
assertEqual
(
'
middle
'
);
expect
(
value
[
2
]).
assertEqual
(
'
large
'
);
expect
(
value
[
3
]).
assertEqual
(
'
extra large
'
);
done
();
})
})
done
();
})
/* *
...
...
@@ -1248,9 +1435,9 @@ describe('resMgrTest', function () {
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getMediaByName
(
'
icon
'
,
(
err
,
value
)
=>
{
expect
(
value
.
length
>
0
).
assertTrue
();
done
();
})
})
done
();
})
/* *
...
...
@@ -1262,9 +1449,9 @@ describe('resMgrTest', function () {
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getMediaByName
(
'
icon
'
).
then
(
value
=>
{
expect
(
value
.
length
>
0
).
assertTrue
();
done
();
})
})
done
();
})
/* *
...
...
@@ -1277,9 +1464,9 @@ describe('resMgrTest', function () {
mgr
.
getMediaBase64ByName
(
'
icon
'
,
(
err
,
value
)
=>
{
expect
(
value
.
length
>
0
).
assertTrue
();
console
.
log
(
'
getMediaBase64ByName_test_001
'
+
value
);
done
();
})
})
done
();
})
/* *
...
...
@@ -1292,9 +1479,9 @@ describe('resMgrTest', function () {
mgr
.
getMediaBase64ByName
(
'
icon
'
).
then
(
value
=>
{
expect
(
value
.
length
>
0
).
assertTrue
();
console
.
log
(
'
getMediaBase64ByName_test_002
'
+
value
);
done
();
})
})
done
();
})
/* *
...
...
@@ -1308,9 +1495,9 @@ describe('resMgrTest', function () {
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getPluralStringByName_test_001
'
+
value
);
expect
(
value
).
assertEqual
(
'
1 test other
'
);
done
();
})
})
done
();
})
/* *
...
...
@@ -1324,9 +1511,9 @@ describe('resMgrTest', function () {
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getPluralStringByName_test_002
'
+
value
);
expect
(
value
).
assertEqual
(
'
1 test other
'
);
done
();
})
})
done
();
})
/* *
...
...
@@ -1336,12 +1523,12 @@ describe('resMgrTest', function () {
*/
it
(
'
getStringSync_test_001
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
let
value
=
mgr
.
getStringSync
(
$r
(
app
.
string
.
app_name
).
id
);
let
value
=
mgr
.
getStringSync
(
0x01000008
);
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getStringSync_test_001
'
+
value
);
expect
(
value
).
assertEqual
(
'
L2Test
'
);
done
();
})
done
();
})
/* *
...
...
@@ -1352,11 +1539,10 @@ describe('resMgrTest', function () {
it
(
'
getStringSync_test_002
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
let
value
=
mgr
.
getStringSync
({
bundleName
:
"
ohos.intl.test
"
,
moduleName
:
"
entry
"
,
id
:
$r
(
app
.
string
.
app_name
).
id
});
moduleName
:
"
entry
"
,
id
:
0x01000008
});
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getStringSync_test_002
'
+
value
);
expect
(
value
).
assertEqual
(
'
L2Test
'
);
})
done
();
})
...
...
@@ -1367,13 +1553,35 @@ describe('resMgrTest', function () {
* @tc.desc get the string in sync mode
*/
it
(
'
getStringByNameSync_test_001
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
try
{
let
value
=
mgr
.
getStringByNameSync
(
'
notexist
'
);
console
.
log
(
'
getStringByNameSync_test_001 value
'
);
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getStringByNameSync_test_001
'
+
value
);
done
();
}
catch
(
e
){
console
.
log
(
'
getStringByNameSync_test_001 err.code
'
+
e
.
code
);
console
.
log
(
'
getStringByNameSync_test_001 err.message
'
+
e
.
message
);
expect
(
e
.
code
==
9001003
).
assertTrue
();
done
();
}
})
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_3500
* @tc.name test getStringByNameSync method
* @tc.desc get the string in sync mode
*/
it
(
'
getStringByNameSync_test_002
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
let
value
=
mgr
.
getStringByNameSync
(
'
app_name
'
);
expect
(
value
!==
null
).
assertTrue
();
console
.
log
(
'
getStringByNameSync_test_001
'
+
value
);
expect
(
value
).
assertEqual
(
'
L2Test
'
);
console
.
log
(
'
getStringByNameSync_test_002
'
+
value
);
done
();
})
done
();
})
/* *
...
...
@@ -1383,11 +1591,11 @@ describe('resMgrTest', function () {
*/
it
(
'
getBoolean_test_001
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
let
value
=
mgr
.
getBoolean
(
$r
(
app
.
boolean
.
boolean_1
).
id
);
let
value
=
mgr
.
getBoolean
(
0x0100000c
);
console
.
log
(
'
getBoolean_test_001
'
+
value
);
expect
(
value
).
assertTrue
();
done
();
})
done
();
})
/* *
...
...
@@ -1398,12 +1606,12 @@ describe('resMgrTest', function () {
it
(
'
getBoolean_test_002
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
let
value
=
mgr
.
getBoolean
({
bundleName
:
"
ohos.intl.test
"
,
moduleName
:
"
entry
"
,
id
:
$r
(
app
.
boolean
.
boolean_1
).
id
});
moduleName
:
"
entry
"
,
id
:
0x0100000c
});
console
.
log
(
'
getBoolean_test_002
'
+
value
);
expect
(
value
).
assertTrue
();
expect
(
value
!==
null
).
assertTrue
();
done
();
})
done
();
})
/* *
...
...
@@ -1416,8 +1624,8 @@ describe('resMgrTest', function () {
let
value
=
mgr
.
getBooleanByName
(
'
boolean_1
'
);
console
.
log
(
'
getBooleanByName_test_001
'
+
value
);
expect
(
value
).
assertTrue
();
done
();
})
done
();
})
/* *
...
...
@@ -1427,11 +1635,13 @@ describe('resMgrTest', function () {
*/
it
(
'
getinteger_test_001
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
let
value
=
mgr
.
getNumber
(
$r
(
app
.
integer
.
integer_1
).
id
);
console
.
log
(
'
getinteger_test_001 0
'
);
let
value
=
mgr
.
getNumber
(
0x01000000
);
console
.
log
(
'
getinteger_test_001 1
'
);
console
.
log
(
'
getinteger_test_001
'
+
value
);
expect
(
value
).
assertEqual
(
100
);
done
();
})
done
();
})
/* *
...
...
@@ -1442,12 +1652,12 @@ describe('resMgrTest', function () {
it
(
'
getinteger_test_002
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
let
value
=
mgr
.
getNumber
({
bundleName
:
"
ohos.intl.test
"
,
moduleName
:
"
entry
"
,
id
:
$r
(
app
.
integer
.
integer_1
).
id
});
moduleName
:
"
entry
"
,
id
:
0x01000000
});
console
.
log
(
'
getinteger_test_002
'
+
value
);
expect
(
value
).
assertEqual
(
100
);
expect
(
value
!==
null
).
assertTrue
();
done
();
})
done
();
})
/* *
...
...
@@ -1460,8 +1670,8 @@ describe('resMgrTest', function () {
let
value
=
mgr
.
getNumberByName
(
'
integer_1
'
);
console
.
log
(
'
getintegerByName_test_001
'
+
value
);
expect
(
value
).
assertEqual
(
100
);
done
();
})
done
();
})
/* *
...
...
@@ -1471,11 +1681,11 @@ describe('resMgrTest', function () {
*/
it
(
'
getfloat_test_001
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
let
value
=
mgr
.
getNumber
(
$r
(
app
.
float
.
float_1
).
id
);
let
value
=
mgr
.
getNumber
(
0x01000015
);
console
.
log
(
'
getfloat_test_001
'
+
value
);
expect
(
value
).
assertEqual
(
48
);
expect
(
value
>
0
).
assertTrue
();
done
();
})
done
();
})
/* *
...
...
@@ -1486,12 +1696,12 @@ describe('resMgrTest', function () {
it
(
'
getfloat_test_002
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
let
value
=
mgr
.
getNumber
({
bundleName
:
"
ohos.intl.test
"
,
moduleName
:
"
entry
"
,
id
:
$r
(
app
.
float
.
float_1
).
id
});
moduleName
:
"
entry
"
,
id
:
0x01000015
});
console
.
log
(
'
getfloat_test_002
'
+
value
);
expect
(
value
).
assertEqual
(
48
);
expect
(
value
!==
null
).
assertTrue
();
done
();
})
done
();
})
/* *
...
...
@@ -1503,9 +1713,9 @@ describe('resMgrTest', function () {
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
let
value
=
mgr
.
getNumberByName
(
'
float_1
'
);
console
.
log
(
'
getfloatByName_test_001
'
+
value
);
expect
(
value
).
assertEqual
(
48
);
expect
(
value
>
0
).
assertTrue
();
done
();
})
done
();
})
console
.
log
(
'
*************end ResmgrTest*************
'
);
...
...
global/resmgr_standard/resmgrjs/src/main/resources/base/element/boolean.json
浏览文件 @
96678c19
...
...
@@ -7,6 +7,14 @@
{
"name"
:
"boolean_2"
,
"value"
:
false
},
{
"name"
:
"boolean_3"
,
"value"
:
"$boolean:boolean_4"
},
{
"name"
:
"boolean_4"
,
"value"
:
"$boolean:boolean_3"
}
]
}
\ No newline at end of file
global/resmgr_standard/resmgrjs/src/main/resources/base/element/plural.json
浏览文件 @
96678c19
...
...
@@ -28,6 +28,32 @@
"value"
:
"%d test other"
}
]
},
{
"name"
:
"plural_name2"
,
"value"
:[
{
"quantity"
:
"one"
,
"value"
:
"$string:Test_name1"
},
{
"quantity"
:
"other"
,
"value"
:
"$string:Test_name1"
}
]
},
{
"name"
:
"plural_name3"
,
"value"
:[
{
"quantity"
:
"one"
,
"value"
:
"$theme:app_theme"
},
{
"quantity"
:
"other"
,
"value"
:
"$theme:app_theme"
}
]
}
]
}
\ No newline at end of file
global/resmgr_standard/resmgrjs/src/main/resources/base/element/strarray.json
浏览文件 @
96678c19
...
...
@@ -16,6 +16,14 @@
"value"
:
"extra large"
}
]
},
{
"name"
:
"sizeList2"
,
"value"
:[
{
"value"
:
"$string:Test_name1"
}
]
}
]
}
\ No newline at end of file
global/resmgr_standard/resmgrjs/src/main/resources/base/element/string.json
浏览文件 @
96678c19
{
"string"
:
[
{
"name"
:
"app_name"
,
"value"
:
"L2Test"
},
{
"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
"string"
:
[
{
"name"
:
"app_name"
,
"value"
:
"L2Test"
},
{
"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
global/resmgr_standard/resmgrjs/src/main/resources/base/element/theme.json
0 → 100644
浏览文件 @
96678c19
{
"theme"
:[
{
"name"
:
"app_theme"
,
"value"
:[
{
"name"
:
"colorbar"
,
"value"
:
"#FF00FF00"
},
{
"name"
:
"noWindow"
,
"value"
:
"true"
},
{
"name"
:
"layout_width"
,
"value"
:
"100dp"
},
{
"name"
:
"background"
,
"value"
:
"#FF00FF00"
},
{
"name"
:
"background111"
,
"value"
:
"#FF00FF00"
},
{
"name"
:
"background222"
,
"value"
:
"#FF00FF00"
},
{
"name"
:
"background333"
,
"value"
:
"$media:icon"
}
]
},
{
"name"
:
"test_theme"
,
"parent"
:
"app_theme"
,
"value"
:[
{
"name"
:
"color"
,
"value"
:
"#FFFFFF00"
},
{
"name"
:
"layout_width"
,
"value"
:
"50dp"
},
{
"name"
:
"colorbar"
,
"value"
:
"#FFFFFF11"
},
{
"name"
:
"hasWindow"
,
"value"
:
"true"
}
]
}
]
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录