Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
630bf798
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
630bf798
编写于
5月 09, 2023
作者:
Y
y00314596
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add by yangqing3@huawei.com
Signed-off-by:
N
y00314596
<
yangqing3@huawei.com
>
上级
918fac39
变更
6
展开全部
隐藏空白更改
内联
并排
Showing
6 changed file
with
833 addition
and
10 deletion
+833
-10
global/i18n_standard/intljs/src/main/js/test/I18n.test.js
global/i18n_standard/intljs/src/main/js/test/I18n.test.js
+102
-10
global/i18n_standard/intljs/src/main/js/test/Intl.test.js
global/i18n_standard/intljs/src/main/js/test/Intl.test.js
+73
-0
global/i18n_standard/intljs/src/main/js/test/Lang.test.js
global/i18n_standard/intljs/src/main/js/test/Lang.test.js
+44
-0
global/i18n_standard/intljs/src/main/js/test/List.test.js
global/i18n_standard/intljs/src/main/js/test/List.test.js
+2
-0
global/i18n_standard/intljs/src/main/js/test/SystemInI18n.test.js
...18n_standard/intljs/src/main/js/test/SystemInI18n.test.js
+574
-0
global/resmgr_standard/resmgrjs/src/main/js/test/Resmgr.test.js
.../resmgr_standard/resmgrjs/src/main/js/test/Resmgr.test.js
+38
-0
未找到文件。
global/i18n_standard/intljs/src/main/js/test/I18n.test.js
浏览文件 @
630bf798
...
...
@@ -342,6 +342,17 @@ describe('I18nTest', function () {
expect
(
value
).
assertEqual
(
'
China
'
);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_3840
* @tc.name getDisplayCountry with zh-Hans-CN and en-US and null param
* @tc.desc check the display country
*/
it
(
'
i18n_test_3840
'
,
0
,
function
()
{
let
value
=
I18n
.
getDisplayCountry
(
'
zh-Hans-CN
'
,
'
en-US
'
,
null
);
console
.
log
(
'
i18n_test_3840
'
+
value
);
expect
(
value
).
assertEqual
(
'
China
'
);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_3900
* @tc.name getDisplayCountry with zh and en-US and true param
...
...
@@ -419,6 +430,17 @@ describe('I18nTest', function () {
expect
(
value
).
assertEqual
(
'
China
'
);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_4321
* @tc.name getDisplayCountry with zh-Hans-CN and en-US and null param
* @tc.desc check the display country
*/
it
(
'
i18n_test_4321
'
,
0
,
function
()
{
let
value
=
I18n
.
System
.
getDisplayCountry
(
'
zh-Hans-CN
'
,
'
en-US
'
,
null
);
console
.
log
(
'
i18n_test_4321
'
+
value
);
expect
(
value
).
assertEqual
(
'
China
'
);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_4330
* @tc.name getDisplayCountry with zh and en-US and true param
...
...
@@ -546,6 +568,17 @@ describe('I18nTest', function () {
expect
(
value
).
assertEqual
(
'
Simplified Chinese
'
);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_4440
* @tc.name getDisplayLanguage with zh-Hans-CN and en-US and null param
* @tc.desc check the language
*/
it
(
'
i18n_test_4440
'
,
0
,
function
()
{
let
value
=
I18n
.
getDisplayLanguage
(
'
zh-Hans-CN
'
,
'
en-US
'
,
null
);
console
.
log
(
'
i18n_test_4440
'
+
value
);
expect
(
value
).
assertEqual
(
'
Simplified Chinese
'
);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_4500
* @tc.name getDisplayLanguage with zh-Hans-CN and en-GB and true param
...
...
@@ -634,6 +667,17 @@ describe('I18nTest', function () {
expect
(
value
).
assertEqual
(
'
Simplified Chinese
'
);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_5021
* @tc.name getDisplayLanguage with zh-Hans-CN and en-US and null param
* @tc.desc check the language
*/
it
(
'
i18n_test_5021
'
,
0
,
function
()
{
let
value
=
I18n
.
System
.
getDisplayLanguage
(
'
zh-Hans-CN
'
,
'
en-US
'
,
null
);
console
.
log
(
'
i18n_test_5021
'
+
value
);
expect
(
value
).
assertEqual
(
'
Simplified Chinese
'
);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_5030
* @tc.name getDisplayLanguage with zh-Hans-CN and en-GB and true param
...
...
@@ -767,30 +811,45 @@ describe('I18nTest', function () {
})
/**
* @tc.number SUB_GLOBAL_I18N_JS_5120
* @tc.number SUB_GLOBAL_I18N_JS_5140
* @tc.name test isValidNumber interface with 13510574676 and null param
* @tc.desc get the isValidNumber value
*/
it
(
'
i18n_test_5140
'
,
0
,
function
()
{
console
.
log
(
'
i18n_test_5140
'
+
'
start
'
);
let
phonenumber
=
new
I18n
.
PhoneNumberFormat
(
'
CN
'
,
null
);
let
ran
=
Math
.
ceil
(
Math
.
random
(
1
)
*
9
);
console
.
log
(
'
i18n_test_5140
'
+
ran
);
let
valid
=
phonenumber
.
isValidNumber
(
'
1351057467
'
+
ran
);
console
.
log
(
'
i18n_test_5140
'
+
valid
);
expect
(
valid
).
assertEqual
(
true
);
})
/**
* @tc.number SUB_GLOBAL_I18N_JS_5160
* @tc.name test isValidNumber interface with 0755-6100088X param
* @tc.desc get the isValidNumber value
*/
it
(
'
i18n_test_51
2
0
'
,
0
,
function
()
{
console
.
log
(
'
i18n_test_51
2
0
'
+
'
start
'
);
it
(
'
i18n_test_51
6
0
'
,
0
,
function
()
{
console
.
log
(
'
i18n_test_51
6
0
'
+
'
start
'
);
let
phonenumber
=
new
I18n
.
PhoneNumberFormat
(
'
CN
'
);
let
ran
=
Math
.
ceil
(
Math
.
random
(
1
)
*
9
);
console
.
log
(
'
i18n_test_51
2
0
'
+
ran
);
console
.
log
(
'
i18n_test_51
6
0
'
+
ran
);
let
valid
=
phonenumber
.
isValidNumber
(
'
0755-6100088
'
+
ran
);
console
.
log
(
'
i18n_test_51
2
0
'
+
valid
);
console
.
log
(
'
i18n_test_51
6
0
'
+
valid
);
expect
(
valid
).
assertEqual
(
true
);
})
/**
* @tc.number SUB_GLOBAL_I18N_JS_51
4
0
* @tc.number SUB_GLOBAL_I18N_JS_51
8
0
* @tc.name test isValidNumber interface with 110 param
* @tc.desc get the isValidNumber value
*/
it
(
'
i18n_test_51
4
0
'
,
0
,
function
()
{
console
.
log
(
'
i18n_test_51
4
0
'
+
'
start
'
);
it
(
'
i18n_test_51
8
0
'
,
0
,
function
()
{
console
.
log
(
'
i18n_test_51
8
0
'
+
'
start
'
);
let
phonenumber
=
new
I18n
.
PhoneNumberFormat
(
'
CN
'
);
let
valid
=
phonenumber
.
isValidNumber
(
'
110
'
);
console
.
log
(
'
i18n_test_51
4
0
'
+
valid
);
console
.
log
(
'
i18n_test_51
8
0
'
+
valid
);
expect
(
valid
).
assertEqual
(
false
);
})
...
...
@@ -1763,7 +1822,7 @@ describe('I18nTest', function () {
})
/**
* @tc.number SUB_GLOBAL_I18N_JS_9
20
0
* @tc.number SUB_GLOBAL_I18N_JS_9
12
0
* @tc.name test unitConvert interface from cup to liter unit with undefined style
* @tc.desc get the unitConvert value
*/
...
...
@@ -1778,6 +1837,22 @@ describe('I18nTest', function () {
expect
(
value
).
assertEqual
(
'
236.588 L
'
);
})
/**
* @tc.number SUB_GLOBAL_I18N_JS_9140
* @tc.name test unitConvert interface from cup to liter unit with null style
* @tc.desc get the unitConvert value
*/
it
(
'
i18n_test_9140
'
,
0
,
function
()
{
console
.
log
(
'
i18n_test_9140
'
+
'
start
'
);
let
value
=
I18n
.
I18NUtil
.
unitConvert
({
unit
:
'
cup
'
,
measureSystem
:
'
US
'
},
{
unit
:
'
liter
'
,
measureSystem
:
'
SI
'
},
1000
,
'
en-US
'
,
null
);
console
.
log
(
'
i18n_test_9140
'
+
value
);
expect
(
value
).
assertEqual
(
'
236.588 L
'
);
})
/**
* @tc.number SUB_GLOBAL_I18N_JS_9200
* @tc.name test unitConvert interface from cup to liter unit with medium style
...
...
@@ -2004,6 +2079,23 @@ describe('I18nTest', function () {
expect
(
value
).
assertEqual
(
'
236.588 L
'
);
})
/**
* @tc.number SUB_GLOBAL_I18N_JS_9931
* @tc.name test unitConvert interface from cup to liter unit with null style
* @tc.desc get the unitConvert value
*/
it
(
'
i18n_test_9931
'
,
0
,
function
()
{
console
.
log
(
'
i18n_test_9931
'
+
'
start
'
);
let
util
=
new
I18n
.
Util
();
let
value
=
util
.
unitConvert
({
unit
:
'
cup
'
,
measureSystem
:
'
US
'
},
{
unit
:
'
liter
'
,
measureSystem
:
'
SI
'
},
1000
,
'
en-US
'
,
null
);
console
.
log
(
'
i18n_test_9931
'
+
value
);
expect
(
value
).
assertEqual
(
'
236.588 L
'
);
})
/**
* @tc.number SUB_GLOBAL_I18N_JS_9940
* @tc.name test unitConvert interface from cup to liter unit with medium style
...
...
global/i18n_standard/intljs/src/main/js/test/Intl.test.js
浏览文件 @
630bf798
...
...
@@ -82,6 +82,19 @@ describe('intlTest', function () {
expect
(
locale
.
numeric
).
assertFalse
();
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_LOCALE_0130
* @tc.name test the language in en-Latn-GB locale
* @tc.desc check the language
*/
it
(
'
locale_test_0130
'
,
0
,
function
()
{
let
locale
=
new
Intl
.
Locale
(
'
en-Latn-GB
'
,
null
);
console
.
log
(
'
locale_test_0130
'
+
locale
.
language
);
console
.
log
(
'
locale_test_0130
'
+
locale
.
numeric
);
expect
(
locale
.
language
).
assertEqual
(
'
en
'
);
expect
(
locale
.
numeric
).
assertFalse
();
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_LOCALE_0140
* @tc.name test the language in locale
...
...
@@ -545,6 +558,18 @@ describe('intlTest', function () {
expect
(
datefmt
.
format
(
date
)).
assertContain
(
'
2021
'
);
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_DATETIME_0240
* @tc.name format the date with zh locale and null options
* @tc.desc check the date
*/
it
(
'
dateTimeFormat_test_0240
'
,
0
,
function
()
{
let
date
=
new
Date
(
2021
,
11
,
17
,
3
,
24
,
0
);
let
datefmt
=
new
Intl
.
DateTimeFormat
(
'
zh
'
,
null
);
console
.
log
(
'
dateTimeFormat_test_0240
'
+
datefmt
.
format
(
date
));
expect
(
datefmt
.
format
(
date
)).
assertContain
(
'
2021
'
);
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_DATETIME_0300
* @tc.name format the date with en locale
...
...
@@ -914,6 +939,17 @@ describe('intlTest', function () {
expect
(
numfmt
.
format
(
123456.789
)).
assertEqual
(
'
123,456.789
'
);
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_NUMBER_0160
* @tc.name format the number in zh and null options
* @tc.desc check the number in zh
*/
it
(
'
formatNumber_test_0160
'
,
0
,
function
()
{
let
numfmt
=
new
Intl
.
NumberFormat
(
'
zh
'
,
null
);
console
.
log
(
'
formatNumber_test_0160
'
+
numfmt
.
format
(
123456.789
));
expect
(
numfmt
.
format
(
123456.789
)).
assertEqual
(
'
123,456.789
'
);
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_NUMBER_0200
* @tc.name format the number in zh-u-nu-latn
...
...
@@ -1321,6 +1357,18 @@ describe('intlTest', function () {
expect
(
value
).
assertEqual
(
'
other
'
);
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_PLURAL_2740
* @tc.name get PluralRules with zh locale and null options
* @tc.desc check the select result
*/
it
(
'
pluralrules_test_2740
'
,
0
,
function
()
{
let
pl
=
new
Intl
.
PluralRules
(
'
zh
'
,
null
);
let
value
=
pl
.
select
(
0
);
console
.
log
(
'
pluralrules_test_2740
'
+
value
);
expect
(
value
).
assertEqual
(
'
other
'
);
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_PLURAL_2800
* @tc.name get PluralRules with zh locale and ordinal type
...
...
@@ -1465,6 +1513,18 @@ describe('intlTest', function () {
expect
(
value
).
assertEqual
(
-
1
);
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_COLLATOR_3640
* @tc.name compare two different strings with zh locale and null options
* @tc.desc check the compare result
*/
it
(
'
collator_test_3640
'
,
0
,
function
()
{
let
coll
=
new
Intl
.
Collator
(
'
zh
'
,
null
);
let
value
=
coll
.
compare
(
'
a
'
,
'
b
'
);
console
.
log
(
'
collator_test_3640
'
+
value
);
expect
(
value
).
assertEqual
(
-
1
);
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_COLLATOR_3700
* @tc.name compare two different strings with zh locale and eor collation
...
...
@@ -1595,6 +1655,19 @@ describe('intlTest', function () {
expect
(
value
).
assertEqual
(
'
in 100 seconds
'
);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_RELATIVETIMEFORMAT_0240
* @tc.name format the relativetime with 100 second in en and null options
* @tc.desc check the relativetime
*/
it
(
'
i18n_test_relativetimeformat_0240
'
,
0
,
function
()
{
console
.
log
(
'
i18n_test_relativetimeformat_0240
'
+
'
start
'
);
let
relativetimefmt
=
new
Intl
.
RelativeTimeFormat
(
'
en
'
,
null
);
let
value
=
relativetimefmt
.
format
(
100
,
'
second
'
);
console
.
log
(
'
i18n_test_relativetimeformat_0240
'
+
value
);
expect
(
value
).
assertEqual
(
'
in 100 seconds
'
);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_RELATIVETIMEFORMAT_0300
* @tc.name format the relativetime with 100 second in narrow style
...
...
global/i18n_standard/intljs/src/main/js/test/Lang.test.js
浏览文件 @
630bf798
...
...
@@ -138,6 +138,18 @@ describe('LangTest', function () {
expect
(
value
.
length
).
assertLarger
(
0
);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_PREFERREDLANGUAGE_0110
* @tc.name test the getPreferredLanguageList interface with default value
* @tc.desc check the value of getPreferredLanguageList method
*/
it
(
'
i18n_test_preferredlanguage_0110
'
,
0
,
function
()
{
console
.
log
(
'
i18n_test_preferredlanguage_0110
'
+
'
start
'
);
let
value
=
I18n
.
System
.
getPreferredLanguageList
();
console
.
log
(
'
i18n_test_preferredlanguage_0110
'
+
value
);
expect
(
value
.
length
).
assertLarger
(
0
);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_PREFERREDLANGUAGE_0120
* @tc.name test the addPreferredLanguage interface
...
...
@@ -199,6 +211,26 @@ describe('LangTest', function () {
}
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_PREFERREDLANGUAGE_1020
* @tc.name test the getFirstPreferredLanguage interface
* @tc.desc check the value of getFirstPreferredLanguage method
*/
it
(
'
i18n_test_preferredlanguage_1020
'
,
0
,
function
()
{
console
.
log
(
'
i18n_test_preferredlanguage_1020
'
+
'
start
'
);
let
value
=
I18n
.
System
.
getFirstPreferredLanguage
();
console
.
log
(
'
i18n_test_preferredlanguage_1020
'
+
value
);
let
list
=
I18n
.
System
.
getPreferredLanguageList
();
console
.
log
(
'
i18n_test_preferredlanguage_1020
'
+
list
);
expect
(
list
.
length
).
assertLarger
(
0
);
if
(
list
[
0
]
==
'
zh-Hans
'
){
expect
(
value
).
assertEqual
(
'
zh-Hans
'
);
}
else
if
(
list
[
0
]
==
'
en
'
){
expect
(
value
).
assertEqual
(
'
en
'
);
}
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_PREFERREDLANGUAGE_1100
* @tc.name test the getAppPreferredLanguage interface
...
...
@@ -211,6 +243,18 @@ describe('LangTest', function () {
expect
(
value
).
assertContain
(
'
zh
'
);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_PREFERREDLANGUAGE_1120
* @tc.name test the getAppPreferredLanguage interface
* @tc.desc check the value of getAppPreferredLanguage method
*/
it
(
'
i18n_test_preferredlanguage_1120
'
,
0
,
function
()
{
console
.
log
(
'
i18n_test_preferredlanguage_1120
'
+
'
start
'
);
let
value
=
I18n
.
System
.
getAppPreferredLanguage
();
console
.
log
(
'
i18n_test_preferredlanguage_1120
'
+
value
);
expect
(
value
).
assertContain
(
'
zh
'
);
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_TRANSFER_0100
* @tc.name transfer from lower to upper
...
...
global/i18n_standard/intljs/src/main/js/test/List.test.js
浏览文件 @
630bf798
...
...
@@ -15,8 +15,10 @@
import
I18nTest
from
'
./I18n.test.js
'
import
intlTest
from
'
./Intl.test.js
'
import
LangTest
from
'
./Lang.test.js
'
import
SystemInI18nTest
from
'
./SystemInI18n.test.js
'
export
default
function
testsuite
()
{
I18nTest
()
intlTest
()
LangTest
()
SystemInI18nTest
()
}
global/i18n_standard/intljs/src/main/js/test/SystemInI18n.test.js
0 → 100644
浏览文件 @
630bf798
此差异已折叠。
点击以展开。
global/resmgr_standard/resmgrjs/src/main/js/test/Resmgr.test.js
浏览文件 @
630bf798
...
...
@@ -1790,6 +1790,25 @@ describe('resMgrTest', function () {
})
})
/**
* @tc.number SUB_GLOBAL_RESMGR_DRAWABLE_JS_0140
* @tc.name getDrawableDescriptor with null density
* @tc.desc test the getDrawableDescriptor method
*/
it
(
'
getDrawableDescriptor_test_0140
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
try
{
let
value
=
mgr
.
getDrawableDescriptor
(
0x01000017
,
null
);
console
.
log
(
'
getDrawableDescriptor_test_0140
'
+
JSON
.
stringify
(
value
));
expect
(
value
!=
null
).
assertTrue
();
}
catch
(
error
){
console
.
log
(
'
getDrawableDescriptor_test_0140
'
+
error
.
code
);
console
.
log
(
'
getDrawableDescriptor_test_0140
'
+
error
.
message
);
}
done
();
})
})
/**
* @tc.number SUB_GLOBAL_RESMGR_DRAWABLE_JS_0200
* @tc.name getDrawableDescriptor with normal pic and density
...
...
@@ -2004,6 +2023,25 @@ describe('resMgrTest', function () {
done
();
})
/**
* @tc.number SUB_GLOBAL_RESMGR_DRAWABLE_JS_1140
* @tc.name getDrawableDescriptorByName with null density
* @tc.desc test the getDrawableDescriptorByName method
*/
it
(
'
getDrawableDescriptor_test_1140
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
try
{
let
value
=
mgr
.
getDrawableDescriptorByName
(
'
icon
'
,
null
);
console
.
log
(
'
getDrawableDescriptor_test_1140
'
+
JSON
.
stringify
(
value
));
expect
(
value
!=
null
).
assertTrue
();
}
catch
(
error
){
console
.
log
(
'
getDrawableDescriptor_test_1140
'
+
error
.
code
);
console
.
log
(
'
getDrawableDescriptor_test_1140
'
+
error
.
message
);
}
})
done
();
})
/**
* @tc.number SUB_GLOBAL_RESMGR_DRAWABLE_JS_1200
* @tc.name getDrawableDescriptorByName with normal pic and density
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录