Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
df247916
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看板
提交
df247916
编写于
5月 05, 2023
作者:
Y
y00314596
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add by yangqing3@huawei.com
Signed-off-by:
N
y00314596
<
yangqing3@huawei.com
>
上级
b7b7938d
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
544 addition
and
58 deletion
+544
-58
global/i18n_standard/intljs/src/main/js/test/I18n.test.js
global/i18n_standard/intljs/src/main/js/test/I18n.test.js
+53
-0
global/i18n_standard/intljs/src/main/js/test/Intl.test.js
global/i18n_standard/intljs/src/main/js/test/Intl.test.js
+85
-0
global/i18n_standard/intljs/src/main/js/test/Lang.test.js
global/i18n_standard/intljs/src/main/js/test/Lang.test.js
+1
-1
global/perf/perfjs/src/main/js/test/Perf.test.js
global/perf/perfjs/src/main/js/test/Perf.test.js
+367
-57
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
浏览文件 @
df247916
...
...
@@ -169,6 +169,17 @@ describe('I18nTest', function () {
expect
(
value
).
assertEqual
(
'
China
'
);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_3820
* @tc.name getDisplayCountry with zh-Hans-CN and en-US and undefined param
* @tc.desc check the display country
*/
it
(
'
i18n_test_3820
'
,
0
,
function
()
{
let
value
=
I18n
.
getDisplayCountry
(
'
zh-Hans-CN
'
,
'
en-US
'
,
undefined
);
console
.
log
(
'
i18n_test_3820
'
+
value
);
expect
(
value
).
assertEqual
(
'
China
'
);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_3900
* @tc.name getDisplayCountry with zh and en-US and true param
...
...
@@ -235,6 +246,17 @@ describe('I18nTest', function () {
expect
(
value
).
assertEqual
(
'
Simplified Chinese
'
);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_4420
* @tc.name getDisplayLanguage with zh-Hans-CN and en-US and undefined param
* @tc.desc check the language
*/
it
(
'
i18n_test_4420
'
,
0
,
function
()
{
let
value
=
I18n
.
getDisplayLanguage
(
'
zh-Hans-CN
'
,
'
en-US
'
,
undefined
);
console
.
log
(
'
i18n_test_4420
'
+
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
...
...
@@ -316,6 +338,21 @@ describe('I18nTest', function () {
expect
(
valid
).
assertEqual
(
true
);
})
/**
* @tc.number SUB_GLOBAL_I18N_JS_5120
* @tc.name test isValidNumber interface with 13510574676 and undefined param
* @tc.desc get the isValidNumber value
*/
it
(
'
i18n_test_5120
'
,
0
,
function
()
{
console
.
log
(
'
i18n_test_5120
'
+
'
start
'
);
let
phonenumber
=
new
I18n
.
PhoneNumberFormat
(
'
CN
'
,
undefined
);
let
ran
=
Math
.
ceil
(
Math
.
random
(
1
)
*
9
);
console
.
log
(
'
i18n_test_5120
'
+
ran
);
let
valid
=
phonenumber
.
isValidNumber
(
'
1351057467
'
+
ran
);
console
.
log
(
'
i18n_test_5120
'
+
valid
);
expect
(
valid
).
assertEqual
(
true
);
})
/**
* @tc.number SUB_GLOBAL_I18N_JS_5120
* @tc.name test isValidNumber interface with 0755-6100088X param
...
...
@@ -1312,6 +1349,22 @@ describe('I18nTest', function () {
expect
(
value
).
assertEqual
(
'
236.588 liters
'
);
})
/**
* @tc.number SUB_GLOBAL_I18N_JS_9200
* @tc.name test unitConvert interface from cup to liter unit with undefined style
* @tc.desc get the unitConvert value
*/
it
(
'
i18n_test_9120
'
,
0
,
function
()
{
console
.
log
(
'
i18n_test_9120
'
+
'
start
'
);
let
value
=
I18n
.
I18NUtil
.
unitConvert
({
unit
:
'
cup
'
,
measureSystem
:
'
US
'
},
{
unit
:
'
liter
'
,
measureSystem
:
'
SI
'
},
1000
,
'
en-US
'
,
undefined
);
console
.
log
(
'
i18n_test_9120
'
+
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
...
...
global/i18n_standard/intljs/src/main/js/test/Intl.test.js
浏览文件 @
df247916
...
...
@@ -69,6 +69,31 @@ describe('intlTest', function () {
expect
(
locale
.
language
).
assertEqual
(
'
en
'
);
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_LOCALE_0120
* @tc.name test the language in en-Latn-GB locale
* @tc.desc check the language
*/
it
(
'
locale_test_0120
'
,
0
,
function
()
{
let
locale
=
new
Intl
.
Locale
(
'
en-Latn-GB
'
,
undefined
);
console
.
log
(
'
locale_test_0120
'
+
locale
.
language
);
console
.
log
(
'
locale_test_0120
'
+
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
* @tc.desc check the language
*/
it
(
'
locale_test_0140
'
,
0
,
function
()
{
let
locale
=
new
Intl
.
Locale
();
console
.
log
(
'
locale_test_0140
'
+
locale
.
language
);
console
.
log
(
'
locale_test_0140
'
+
locale
.
numeric
);
expect
(
locale
.
numeric
).
assertFalse
();
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_LOCALE_0200
* @tc.name test the language in ja-Jpan-JP-u-ca-japanese-hc-h12-co-emoji locale
...
...
@@ -508,6 +533,18 @@ describe('intlTest', function () {
expect
(
datefmt
.
format
(
date
)).
assertContain
(
'
2021
'
);
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_DATETIME_0220
* @tc.name format the date with zh locale and undefined options
* @tc.desc check the date
*/
it
(
'
dateTimeFormat_test_0220
'
,
0
,
function
()
{
let
date
=
new
Date
(
2021
,
11
,
17
,
3
,
24
,
0
);
let
datefmt
=
new
Intl
.
DateTimeFormat
(
'
zh
'
,
undefined
);
console
.
log
(
'
dateTimeFormat_test_0220
'
+
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
...
...
@@ -866,6 +903,17 @@ describe('intlTest', function () {
expect
(
numfmt
!==
null
).
assertTrue
();
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_NUMBER_0140
* @tc.name format the number in zh and undefined options
* @tc.desc check the number in zh
*/
it
(
'
formatNumber_test_0140
'
,
0
,
function
()
{
let
numfmt
=
new
Intl
.
NumberFormat
(
'
zh
'
,
undefined
);
console
.
log
(
'
formatNumber_test_0140
'
+
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
...
...
@@ -1261,6 +1309,18 @@ describe('intlTest', function () {
expect
(
value
).
assertEqual
(
'
other
'
);
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_PLURAL_2720
* @tc.name get PluralRules with zh locale and undefined options
* @tc.desc check the select result
*/
it
(
'
pluralrules_test_2720
'
,
0
,
function
()
{
let
pl
=
new
Intl
.
PluralRules
(
'
zh
'
,
undefined
);
let
value
=
pl
.
select
(
0
);
console
.
log
(
'
pluralrules_test_2720
'
+
value
);
expect
(
value
).
assertEqual
(
'
other
'
);
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_PLURAL_2800
* @tc.name get PluralRules with zh locale and ordinal type
...
...
@@ -1393,6 +1453,18 @@ describe('intlTest', function () {
expect
(
value
).
assertEqual
(
-
1
);
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_COLLATOR_3620
* @tc.name compare two different strings with zh locale and undefined options
* @tc.desc check the compare result
*/
it
(
'
collator_test_3620
'
,
0
,
function
()
{
let
coll
=
new
Intl
.
Collator
(
'
zh
'
,
undefined
);
let
value
=
coll
.
compare
(
'
a
'
,
'
b
'
);
console
.
log
(
'
collator_test_3620
'
+
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
...
...
@@ -1510,6 +1582,19 @@ describe('intlTest', function () {
expect
(
value
).
assertEqual
(
'
in 100 seconds
'
);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_RELATIVETIMEFORMAT_0220
* @tc.name format the relativetime with 100 second in en and undefined options
* @tc.desc check the relativetime
*/
it
(
'
i18n_test_relativetimeformat_0220
'
,
0
,
function
()
{
console
.
log
(
'
i18n_test_relativetimeformat_0220
'
+
'
start
'
);
let
relativetimefmt
=
new
Intl
.
RelativeTimeFormat
(
'
en
'
,
undefined
);
let
value
=
relativetimefmt
.
format
(
100
,
'
second
'
);
console
.
log
(
'
i18n_test_relativetimeformat_0220
'
+
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
浏览文件 @
df247916
...
...
@@ -582,7 +582,7 @@ describe('LangTest', function () {
* @tc.desc get the getUsingLocalDigit value
*/
it
(
'
localdigit_test_0100
'
,
0
,
function
()
{
let
value
=
I18n
.
getUsingLocalDigit
();
let
value
=
I18n
.
System
.
getUsingLocalDigit
();
console
.
log
(
'
localdigit_test_0100
'
+
value
);
expect
(
value
).
assertFalse
();
})
...
...
global/perf/perfjs/src/main/js/test/Perf.test.js
浏览文件 @
df247916
...
...
@@ -97,6 +97,108 @@ describe('PerfTest', function () {
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_0120
* @tc.name test the performance of getSystemLanguage
* @tc.desc check the performance of getSystemLanguage
*/
it
(
'
perf_test_0120
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_0120
'
+
'
start
'
);
let
lang
=
'
test
'
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
lang
=
I18n
.
System
.
getSystemLanguage
();
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_0120--
'
+
'
lang:
'
+
lang
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_0140
* @tc.name test the performance of getSystemLanguages
* @tc.desc check the performance of getSystemLanguages
*/
it
(
'
perf_test_0140
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_0140
'
+
'
start
'
);
let
lang
=
'
test
'
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
lang
=
I18n
.
System
.
getSystemLanguages
();
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_0140--
'
+
'
lang:
'
+
lang
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_0160
* @tc.name test the performance of getSystemCountries
* @tc.desc check the performance of getSystemCountries
*/
it
(
'
perf_test_0160
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_0160
'
+
'
start
'
);
let
value
=
'
test
'
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
I18n
.
System
.
getSystemCountries
(
'
zh
'
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_0160--
'
+
'
value:
'
+
value
);
console
.
log
(
'
perf_test_0160--
'
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_0180
* @tc.name test the performance of isSuggested
* @tc.desc check the performance of isSuggested
*/
it
(
'
perf_test_0180
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_0180
'
+
'
start
'
);
let
value
=
false
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
I18n
.
System
.
isSuggested
(
'
zh
'
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_0180--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_0200
* @tc.name test the performance of getSystemRegion
...
...
@@ -123,6 +225,32 @@ describe('PerfTest', function () {
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_0220
* @tc.name test the performance of getSystemRegion
* @tc.desc check the performance of getSystemRegion
*/
it
(
'
perf_test_0220
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_0220
'
+
'
start
'
);
let
region
=
'
test
'
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
region
=
I18n
.
System
.
getSystemRegion
();
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_0220--
'
+
'
region:
'
+
region
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_0300
* @tc.name test the performance of getSystemLocale
...
...
@@ -149,6 +277,32 @@ describe('PerfTest', function () {
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_0320
* @tc.name test the performance of getSystemLocale
* @tc.desc check the performance of getSystemLocale
*/
it
(
'
perf_test_0320
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_0320
'
+
'
start
'
);
let
locale
=
'
test
'
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
locale
=
I18n
.
System
.
getSystemLocale
();
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_0320--
'
+
'
locale:
'
+
locale
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_1000
* @tc.name test the performance of getDisplayCountry
...
...
@@ -175,6 +329,32 @@ describe('PerfTest', function () {
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_1020
* @tc.name test the performance of getDisplayCountry
* @tc.desc check the performance of getDisplayCountry
*/
it
(
'
perf_test_1020
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_1020
'
+
'
start
'
);
let
value
=
'
test
'
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
I18n
.
System
.
getDisplayCountry
(
'
zh-Hans-CN
'
,
'
en-US
'
,
true
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_1020--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_1100
* @tc.name test the performance of getDisplayLanguage
...
...
@@ -201,6 +381,32 @@ describe('PerfTest', function () {
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_1120
* @tc.name test the performance of getDisplayLanguage
* @tc.desc check the performance of getDisplayLanguage
*/
it
(
'
perf_test_1120
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_1120
'
+
'
start
'
);
let
value
=
'
test
'
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
I18n
.
System
.
getDisplayLanguage
(
'
zh-Hans-CN
'
,
'
en-US
'
,
true
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_1120--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_1200
* @tc.name test the performance of PhoneNumberFormat
...
...
@@ -285,6 +491,36 @@ describe('PerfTest', function () {
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_1450
* @tc.name test the performance of getLocationName
* @tc.desc check the performance of getLocationName
*/
it
(
'
perf_test_1450
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_1450
'
+
'
start
'
);
let
phonenumber
=
new
I18n
.
PhoneNumberFormat
(
'
CN
'
);
let
ran
=
Math
.
ceil
(
Math
.
random
(
1
)
*
9
);
console
.
log
(
'
perf_test_1450
'
+
ran
);
let
value
=
'
test
'
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
phonenumber
.
getLocationName
(
'
1351057467
'
+
ran
,
'
zh-CN
'
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_1450--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
expect
(
value
==
'
中国
'
||
value
==
'
广东省深圳市
'
).
assertTrue
();
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_1500
* @tc.name test the performance of getCalendar
...
...
@@ -654,6 +890,32 @@ describe('PerfTest', function () {
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_2850
* @tc.name test the performance of getDateOrder
* @tc.desc check the performance of getDateOrder
*/
it
(
'
perf_test_2850
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_2850
'
+
'
start
'
);
let
value
=
'
test
'
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
I18n
.
I18NUtil
.
getDateOrder
(
'
zh
'
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_2850--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_2900
* @tc.name test the performance of isRTL
...
...
@@ -1319,6 +1581,32 @@ describe('PerfTest', function () {
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_5320
* @tc.name test the performance of is24HourClock
* @tc.desc check the performance of is24HourClock
*/
it
(
'
perf_test_5320
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_5320
'
+
'
start
'
);
let
value
=
false
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
I18n
.
System
.
is24HourClock
();
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_5320--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_5500
* @tc.name test the performance of getPreferredLanguageList
...
...
@@ -1345,6 +1633,32 @@ describe('PerfTest', function () {
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_5520
* @tc.name test the performance of getPreferredLanguageList
* @tc.desc check the performance of getPreferredLanguageList
*/
it
(
'
perf_test_5520
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_5520
'
+
'
start
'
);
let
value
=
new
Array
();
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
I18n
.
System
.
getPreferredLanguageList
();
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_5520--
'
+
'
value.length:
'
+
value
.
length
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_5600
* @tc.name test the performance of getFirstPreferredLanguage
...
...
@@ -1371,6 +1685,58 @@ describe('PerfTest', function () {
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_5620
* @tc.name test the performance of getFirstPreferredLanguage
* @tc.desc check the performance of getFirstPreferredLanguage
*/
it
(
'
perf_test_5620
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_5620
'
+
'
start
'
);
let
value
=
'
test
'
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
I18n
.
System
.
getFirstPreferredLanguage
();
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_5620--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
20
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_5640
* @tc.name test the performance of getAppPreferredLanguage
* @tc.desc check the performance of getAppPreferredLanguage
*/
it
(
'
perf_test_5640
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_5640
'
+
'
start
'
);
let
value
=
'
test
'
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
I18n
.
System
.
getAppPreferredLanguage
();
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_5640--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
20
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_5900
* @tc.name test the performance of Locale
...
...
@@ -2091,32 +2457,6 @@ describe('PerfTest', function () {
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_8600
* @tc.name test the performance of getDateOrder
* @tc.desc check the performance of getDateOrder
*/
it
(
'
perf_test_8600
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_8600
'
+
'
start
'
);
let
value
=
'
test
'
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
I18n
.
I18NUtil
.
getDateOrder
(
'
zh
'
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_8600--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_8700
* @tc.name test the performance of getAvailableIDs
...
...
@@ -2196,36 +2536,6 @@ describe('PerfTest', function () {
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_9000
* @tc.name test the performance of getLocationName
* @tc.desc check the performance of getLocationName
*/
it
(
'
perf_test_9000
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_9000
'
+
'
start
'
);
let
phonenumber
=
new
I18n
.
PhoneNumberFormat
(
'
CN
'
);
let
ran
=
Math
.
ceil
(
Math
.
random
(
1
)
*
9
);
console
.
log
(
'
perf_test_9000
'
+
ran
);
let
value
=
'
test
'
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
phonenumber
.
getLocationName
(
'
1351057467
'
+
ran
,
'
zh-CN
'
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_9000--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
expect
(
value
==
'
中国
'
||
value
==
'
广东省深圳市
'
).
assertTrue
();
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_9100
* @tc.name test the performance of getUsingLocalDigit
...
...
@@ -2236,7 +2546,7 @@ describe('PerfTest', function () {
let
value
=
true
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
I18n
.
getUsingLocalDigit
();
value
=
I18n
.
System
.
getUsingLocalDigit
();
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
...
...
global/resmgr_standard/resmgrjs/src/main/js/test/Resmgr.test.js
浏览文件 @
df247916
...
...
@@ -1771,6 +1771,25 @@ describe('resMgrTest', function () {
done
();
})
/**
* @tc.number SUB_GLOBAL_RESMGR_DRAWABLE_JS_0120
* @tc.name getDrawableDescriptor with undefined density
* @tc.desc test the getDrawableDescriptor method
*/
it
(
'
getDrawableDescriptor_test_0120
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
try
{
let
value
=
mgr
.
getDrawableDescriptor
(
0x01000017
,
undefined
);
console
.
log
(
'
getDrawableDescriptor_test_0120
'
+
JSON
.
stringify
(
value
));
expect
(
value
!=
null
).
assertTrue
();
}
catch
(
error
){
console
.
log
(
'
getDrawableDescriptor_test_0120
'
+
error
.
code
);
console
.
log
(
'
getDrawableDescriptor_test_0120
'
+
error
.
message
);
}
done
();
})
})
/**
* @tc.number SUB_GLOBAL_RESMGR_DRAWABLE_JS_0200
* @tc.name getDrawableDescriptor with normal pic and density
...
...
@@ -1966,6 +1985,25 @@ describe('resMgrTest', function () {
done
();
})
/**
* @tc.number SUB_GLOBAL_RESMGR_DRAWABLE_JS_1120
* @tc.name getDrawableDescriptorByName with undefined density
* @tc.desc test the getDrawableDescriptorByName method
*/
it
(
'
getDrawableDescriptor_test_1120
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
try
{
let
value
=
mgr
.
getDrawableDescriptorByName
(
'
icon
'
,
undefined
);
console
.
log
(
'
getDrawableDescriptor_test_1120
'
+
JSON
.
stringify
(
value
));
expect
(
value
!=
null
).
assertTrue
();
}
catch
(
error
){
console
.
log
(
'
getDrawableDescriptor_test_1120
'
+
error
.
code
);
console
.
log
(
'
getDrawableDescriptor_test_1120
'
+
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录