Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
51610151
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
12 个月 前同步成功
通知
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,发现更多精彩内容 >>
未验证
提交
51610151
编写于
6月 07, 2022
作者:
O
openharmony_ci
提交者:
Gitee
6月 07, 2022
浏览文件
操作
浏览文件
下载
差异文件
!3452 modify syscases to 3.1 rls
Merge pull request !3452 from 杨清/cherry-pick-1654572819
上级
557d3b02
3ba68143
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
12 addition
and
510 deletion
+12
-510
global/i18n_standard/intljs/src/main/js/default/test/I18n.test.js
...18n_standard/intljs/src/main/js/default/test/I18n.test.js
+2
-4
global/i18n_standard/intljs/src/main/js/default/test/Intl.test.js
...18n_standard/intljs/src/main/js/default/test/Intl.test.js
+5
-7
global/i18n_standard/intljs/src/main/js/default/test/Lang.test.js
...18n_standard/intljs/src/main/js/default/test/Lang.test.js
+5
-384
global/perf/perfjs/src/main/js/default/test/Perf.test.js
global/perf/perfjs/src/main/js/default/test/Perf.test.js
+0
-115
未找到文件。
global/i18n_standard/intljs/src/main/js/default/test/I18n.test.js
浏览文件 @
51610151
...
...
@@ -43,9 +43,7 @@ describe('I18nTest', function () {
* execute this step after every testcase
*/
afterEach
(
function
(){
let
afterValue
=
I18n
.
set24HourClock
(
hour
);
console
.
log
(
'
step after every cases.
'
+
afterValue
);
console
.
log
(
'
24 hour clock after every cases
'
+
I18n
.
is24HourClock
());
console
.
log
(
'
step after every case in I18n.
'
);
})
/* *
...
...
@@ -708,7 +706,7 @@ describe('I18nTest', function () {
expect
(
name
).
assertEqual
(
'
和暦
'
);
let
timezone
=
calendar
.
getTimeZone
();
console
.
log
(
'
i18n_test_7920
'
+
timezone
);
expect
(
timezone
).
assert
Equal
(
'
Coordinated Universal
Time
'
);
expect
(
timezone
).
assert
Contain
(
'
Time
'
);
let
firstday
=
calendar
.
getFirstDayOfWeek
();
console
.
log
(
'
i18n_test_7920
'
+
firstday
);
expect
(
firstday
).
assertEqual
(
1
);
...
...
global/i18n_standard/intljs/src/main/js/default/test/Intl.test.js
浏览文件 @
51610151
...
...
@@ -44,9 +44,7 @@ describe('intlTest', function () {
* execute this step after every testcase
*/
afterEach
(
function
(){
let
afterValue
=
I18n
.
set24HourClock
(
hour
);
console
.
log
(
'
step after every cases.
'
+
afterValue
);
console
.
log
(
'
24 hour clock after every cases
'
+
I18n
.
is24HourClock
());
console
.
log
(
'
step after every case in I18n.
'
);
})
/* *
...
...
@@ -607,7 +605,7 @@ describe('intlTest', function () {
let
option
=
{
dateStyle
:
'
full
'
};
let
datefmt
=
new
Intl
.
DateTimeFormat
([
'
abc
'
,
'
ban
'
],
option
);
console
.
log
(
'
dateTimeFormat_test_0800
'
+
datefmt
.
format
(
date
));
expect
(
datefmt
.
format
(
date
)).
assert
Equal
(
'
2020年12月20日星期日
'
);
expect
(
datefmt
.
format
(
date
)).
assert
Contain
(
'
2020
'
);
})
/* *
...
...
@@ -620,7 +618,7 @@ describe('intlTest', function () {
let
option
=
{
dateStyle
:
'
full
'
,
timeStyle
:
'
full
'
};
let
datefmt
=
new
Intl
.
DateTimeFormat
(
'
zh-Hans-CN
'
,
option
);
console
.
log
(
'
dateTimeFormat_test_0900
'
+
datefmt
.
format
(
date
));
expect
(
datefmt
.
format
(
date
)).
assert
Equal
(
'
2020年12月20日星期日 协调世界时 下午2:23:16
'
);
expect
(
datefmt
.
format
(
date
)).
assert
Contain
(
'
2020年12月20日星期日
'
);
})
/* *
...
...
@@ -634,7 +632,7 @@ describe('intlTest', function () {
let
datefmt
=
new
Intl
.
DateTimeFormat
(
'
zh-CN
'
,
option
);
console
.
log
(
'
dateTimeFormat_test_1000
'
+
datefmt
.
resolvedOptions
().
dateStyle
);
expect
(
datefmt
.
resolvedOptions
().
dateStyle
).
assertEqual
(
'
long
'
);
expect
(
datefmt
.
format
(
date
)).
assert
Equal
(
'
2020年12月20日 UTC 下午2:23:16
'
);
expect
(
datefmt
.
format
(
date
)).
assert
Contain
(
'
2020年12月20日
'
);
})
/* *
...
...
@@ -1495,7 +1493,7 @@ describe('intlTest', function () {
let
relativetimefmt
=
new
Intl
.
RelativeTimeFormat
();
let
value
=
relativetimefmt
.
format
(
100
,
'
second
'
);
console
.
log
(
'
i18n_test_relativetimeformat_0100
'
+
value
);
expect
(
value
).
assert
Equal
(
'
100秒钟后
'
);
expect
(
value
).
assert
Contain
(
'
100
'
);
})
/* *
...
...
global/i18n_standard/intljs/src/main/js/default/test/Lang.test.js
浏览文件 @
51610151
...
...
@@ -44,40 +44,6 @@ describe('LangTest', function () {
return
false
}
/* *
* clear the preferred language list if exists
*/
function
clearLang
(
langList
){
let
len
=
langList
.
length
;
while
(
len
>
0
){
console
.
log
(
'
i18n_test_preferredlanguage_clearLang
'
+
len
);
let
par
=
len
-
1
;
console
.
log
(
'
i18n_test_preferredlanguage_clearLang
'
+
par
);
let
value
=
I18n
.
removePreferredLanguage
(
par
);
console
.
log
(
'
i18n_test_preferredlanguage_clearLang
'
+
value
);
len
--
;
}
console
.
log
(
'
i18n_test_preferredlanguage_clearLang
'
+
I18n
.
getPreferredLanguageList
());
}
/* *
* restore the init lang list
*/
function
restoreLang
(){
for
(
let
j
=
0
;
j
<
initLen
;
j
++
){
let
value
=
I18n
.
addPreferredLanguage
(
initPreferredLang
[
j
],
j
);
console
.
log
(
'
i18n_test_preferredlanguage_restoreLang
'
+
value
);
expect
(
value
).
assertTrue
();
}
let
currLen
=
getCurrentPreferredLang
().
length
;
while
(
currLen
>
initLen
)
{
let
rem
=
I18n
.
removePreferredLanguage
(
currLen
-
1
);
console
.
log
(
'
i18n_test_preferredlanguage_restoreLang
'
+
rem
);
currLen
--
;
}
console
.
log
(
'
i18n_test_preferredlanguage_restoreLang
'
+
I18n
.
getPreferredLanguageList
());
}
/* *
* execute this step before all testcases
*/
...
...
@@ -101,11 +67,6 @@ describe('LangTest', function () {
afterEach
(
function
(){
let
currLang
=
getCurrentPreferredLang
();
console
.
log
(
'
i18n_test_preferredlanguage_afterEach
'
+
currLang
);
clearLang
(
currLang
);
restoreLang
();
let
afterValue
=
I18n
.
set24HourClock
(
hour
);
console
.
log
(
'
step after every cases.
'
+
afterValue
);
console
.
log
(
'
24 hour clock after every cases
'
+
I18n
.
is24HourClock
());
})
/* *
...
...
@@ -137,53 +98,6 @@ describe('LangTest', function () {
}
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_CLOCK_0200
* @tc.name test the set24HourClock interface with true param
* @tc.desc check the value of set24HourClock method
*/
it
(
'
i18n_test_clock_0200
'
,
0
,
function
()
{
console
.
log
(
'
i18n_test_clock_0200
'
+
'
start
'
);
let
value
=
I18n
.
set24HourClock
(
true
);
console
.
log
(
'
i18n_test_clock_0200
'
+
value
);
expect
(
value
).
assertTrue
();
let
value2
=
I18n
.
is24HourClock
();
console
.
log
(
'
i18n_test_clock_0200
'
+
value2
);
expect
(
value2
).
assertTrue
();
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_CLOCK_0300
* @tc.name test the set24HourClock interface with false param
* @tc.desc check the value of set24HourClock method
*/
it
(
'
i18n_test_clock_0300
'
,
0
,
function
()
{
console
.
log
(
'
i18n_test_clock_0300
'
+
'
start
'
);
let
value
=
I18n
.
set24HourClock
(
false
);
console
.
log
(
'
i18n_test_clock_0300
'
+
value
);
expect
(
value
).
assertTrue
();
let
value2
=
I18n
.
is24HourClock
();
console
.
log
(
'
i18n_test_clock_0300
'
+
value2
);
expect
(
value2
).
assertFalse
();
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_CLOCK_0400
* @tc.name test the set24HourClock and datetime interface
* @tc.desc check the value of set24HourClock method
*/
it
(
'
i18n_test_clock_0400
'
,
0
,
function
()
{
console
.
log
(
'
i18n_test_clock_0400
'
+
'
start
'
);
let
value
=
I18n
.
set24HourClock
(
true
);
console
.
log
(
'
i18n_test_clock_0400
'
+
value
);
expect
(
value
).
assertTrue
();
let
date
=
new
Date
(
2021
,
11
,
17
,
3
,
24
,
0
);
let
datefmt
=
new
Intl
.
DateTimeFormat
(
'
en
'
);
console
.
log
(
'
i18n_test_clock_0400
'
+
datefmt
.
format
(
date
));
expect
(
datefmt
.
format
(
date
)).
assertEqual
(
'
12/17/21
'
);
expect
(
datefmt
.
resolvedOptions
().
hour12
).
assertFalse
();
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_PREFERREDLANGUAGE_0100
* @tc.name test the getPreferredLanguageList interface with default value
...
...
@@ -196,299 +110,6 @@ describe('LangTest', function () {
expect
(
value
.
length
).
assertLarger
(
0
);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_PREFERREDLANGUAGE_0200
* @tc.name test the addPreferredLanguage interface
* @tc.desc check the value of addPreferredLanguage method
*/
it
(
'
i18n_test_preferredlanguage_0200
'
,
0
,
function
()
{
console
.
log
(
'
i18n_test_preferredlanguage_0200
'
+
'
start
'
);
let
value
=
I18n
.
addPreferredLanguage
(
'
zh
'
);
console
.
log
(
'
i18n_test_preferredlanguage_0200
'
+
value
);
expect
(
value
).
assertTrue
();
let
list
=
I18n
.
getPreferredLanguageList
();
console
.
log
(
'
i18n_test_preferredlanguage_0200
'
+
list
);
expect
(
list
.
length
).
assertLarger
(
0
);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_PREFERREDLANGUAGE_0220
* @tc.name test the addPreferredLanguage interface with abc param
* @tc.desc check the value of addPreferredLanguage method
*/
it
(
'
i18n_test_preferredlanguage_0220
'
,
0
,
function
()
{
console
.
log
(
'
i18n_test_preferredlanguage_0220
'
+
'
start
'
);
let
value
=
I18n
.
addPreferredLanguage
(
'
abc
'
);
console
.
log
(
'
i18n_test_preferredlanguage_0220
'
+
value
);
expect
(
value
).
assertTrue
();
let
list
=
I18n
.
getPreferredLanguageList
();
console
.
log
(
'
i18n_test_preferredlanguage_0220
'
+
list
);
expect
(
list
.
length
).
assertLarger
(
0
);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_PREFERREDLANGUAGE_0300
* @tc.name test the addPreferredLanguage interface with en and 0 param
* @tc.desc check the value of addPreferredLanguage method
*/
it
(
'
i18n_test_preferredlanguage_0300
'
,
0
,
function
()
{
console
.
log
(
'
i18n_test_preferredlanguage_0300
'
+
'
start
'
);
let
list
=
I18n
.
getPreferredLanguageList
();
console
.
log
(
'
i18n_test_preferredlanguage_0300
'
+
list
);
expect
(
list
.
length
).
assertLarger
(
0
);
if
(
list
[
0
]
!=
'
en
'
){
let
value
=
I18n
.
addPreferredLanguage
(
'
en
'
,
0
);
console
.
log
(
'
i18n_test_preferredlanguage_0300
'
+
value
);
expect
(
value
).
assertTrue
();
}
else
{
let
value
=
I18n
.
addPreferredLanguage
(
'
zh
'
,
0
);
console
.
log
(
'
i18n_test_preferredlanguage_0300
'
+
value
);
expect
(
value
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_PREFERREDLANGUAGE_0320
* @tc.name test the addPreferredLanguage interface with abc and index 0 param
* @tc.desc check the value of addPreferredLanguage method
*/
it
(
'
i18n_test_preferredlanguage_0320
'
,
0
,
function
()
{
console
.
log
(
'
i18n_test_preferredlanguage_0320
'
+
'
start
'
);
let
value
=
I18n
.
addPreferredLanguage
(
'
abc
'
,
0
);
console
.
log
(
'
i18n_test_preferredlanguage_0320
'
+
value
);
expect
(
value
).
assertTrue
();
let
list
=
I18n
.
getPreferredLanguageList
();
console
.
log
(
'
i18n_test_preferredlanguage_0320
'
+
list
);
expect
(
list
.
length
).
assertLarger
(
0
);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_PREFERREDLANGUAGE_0340
* @tc.name test the addPreferredLanguage interface with en and index 1.5 param
* @tc.desc check the value of addPreferredLanguage method
*/
it
(
'
i18n_test_preferredlanguage_0340
'
,
0
,
function
()
{
console
.
log
(
'
i18n_test_preferredlanguage_0340
'
+
'
start
'
);
let
list
=
I18n
.
getPreferredLanguageList
();
console
.
log
(
'
i18n_test_preferredlanguage_0340
'
+
list
);
expect
(
list
.
length
).
assertLarger
(
0
);
if
(
list
[
0
]
!=
'
en
'
){
let
value
=
I18n
.
addPreferredLanguage
(
'
en
'
,
1.5
);
console
.
log
(
'
i18n_test_preferredlanguage_0340
'
+
value
);
expect
(
value
).
assertTrue
();
}
else
{
let
value
=
I18n
.
addPreferredLanguage
(
'
zh
'
,
1
);
console
.
log
(
'
i18n_test_preferredlanguage_0340
'
+
value
);
expect
(
value
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_PREFERREDLANGUAGE_0400
* @tc.name test the addPreferredLanguage interface with en and index 1 param
* @tc.desc check the value of addPreferredLanguage method
*/
it
(
'
i18n_test_preferredlanguage_0400
'
,
0
,
function
()
{
console
.
log
(
'
i18n_test_preferredlanguage_0400
'
+
'
start
'
);
let
list
=
I18n
.
getPreferredLanguageList
();
console
.
log
(
'
i18n_test_preferredlanguage_0400
'
+
list
);
expect
(
list
.
length
).
assertLarger
(
0
);
if
(
list
[
0
]
!=
'
en
'
){
let
value
=
I18n
.
addPreferredLanguage
(
'
en
'
,
1
);
console
.
log
(
'
i18n_test_preferredlanguage_0400
'
+
value
);
expect
(
value
).
assertTrue
();
}
else
{
let
value
=
I18n
.
addPreferredLanguage
(
'
zh
'
,
1
);
console
.
log
(
'
i18n_test_preferredlanguage_0400
'
+
value
);
expect
(
value
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_PREFERREDLANGUAGE_0500
* @tc.name test the addPreferredLanguage interface with ja and index -1 param
* @tc.desc check the value of addPreferredLanguage method
*/
it
(
'
i18n_test_preferredlanguage_0500
'
,
0
,
function
()
{
console
.
log
(
'
i18n_test_preferredlanguage_0500
'
+
'
start
'
);
let
value
=
I18n
.
addPreferredLanguage
(
'
ja
'
,
-
1
);
console
.
log
(
'
i18n_test_preferredlanguage_0500
'
+
value
);
expect
(
value
).
assertTrue
();
let
list
=
I18n
.
getPreferredLanguageList
();
console
.
log
(
'
i18n_test_preferredlanguage_0500
'
+
list
);
expect
(
list
.
length
).
assertLarger
(
0
);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_PREFERREDLANGUAGE_0600
* @tc.name test the addPreferredLanguage interface with ko and index 100 param
* @tc.desc check the value of addPreferredLanguage method
*/
it
(
'
i18n_test_preferredlanguage_0600
'
,
0
,
function
()
{
console
.
log
(
'
i18n_test_preferredlanguage_0600
'
+
'
start
'
);
let
value
=
I18n
.
addPreferredLanguage
(
'
ko
'
,
100
);
console
.
log
(
'
i18n_test_preferredlanguage_0600
'
+
value
);
expect
(
value
).
assertTrue
();
let
list
=
I18n
.
getPreferredLanguageList
();
console
.
log
(
'
i18n_test_preferredlanguage_0600
'
+
list
);
expect
(
list
.
length
).
assertLarger
(
0
);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_PREFERREDLANGUAGE_0700
* @tc.name test the removePreferredLanguage interface with 0 param
* @tc.desc check the value of removePreferredLanguage method
*/
it
(
'
i18n_test_preferredlanguage_0700
'
,
0
,
function
()
{
console
.
log
(
'
i18n_test_preferredlanguage_0700
'
+
'
start
'
);
let
value
=
I18n
.
removePreferredLanguage
(
0
);
console
.
log
(
'
i18n_test_preferredlanguage_0700
'
+
value
);
expect
(
value
).
assertFalse
();
let
list
=
I18n
.
getPreferredLanguageList
();
console
.
log
(
'
i18n_test_preferredlanguage_0700
'
+
list
);
expect
(
list
.
length
).
assertLarger
(
0
);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_PREFERREDLANGUAGE_0720
* @tc.name test the removePreferredLanguage interface with 0.5 param
* @tc.desc check the value of removePreferredLanguage method
*/
it
(
'
i18n_test_preferredlanguage_0720
'
,
0
,
function
()
{
console
.
log
(
'
i18n_test_preferredlanguage_0720
'
+
'
start
'
);
let
value
=
I18n
.
removePreferredLanguage
(
0.5
);
console
.
log
(
'
i18n_test_preferredlanguage_0720
'
+
value
);
expect
(
value
).
assertFalse
();
let
list
=
I18n
.
getPreferredLanguageList
();
console
.
log
(
'
i18n_test_preferredlanguage_0720
'
+
list
);
expect
(
list
.
length
).
assertLarger
(
0
);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_PREFERREDLANGUAGE_0800
* @tc.name test the removePreferredLanguage interface with -1 param
* @tc.desc check the value of removePreferredLanguage method
*/
it
(
'
i18n_test_preferredlanguage_0800
'
,
0
,
function
()
{
console
.
log
(
'
i18n_test_preferredlanguage_0800
'
+
'
start
'
);
let
value
=
I18n
.
removePreferredLanguage
(
-
1
);
console
.
log
(
'
i18n_test_preferredlanguage_0800
'
+
value
);
expect
(
value
).
assertFalse
();
let
list
=
I18n
.
getPreferredLanguageList
();
console
.
log
(
'
i18n_test_preferredlanguage_0800
'
+
list
);
expect
(
list
.
length
).
assertLarger
(
0
);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_PREFERREDLANGUAGE_0820
* @tc.name test the removePreferredLanguage interface with -1 param after add ja
* @tc.desc check the value of removePreferredLanguage method
*/
it
(
'
i18n_test_preferredlanguage_0820
'
,
0
,
function
()
{
console
.
log
(
'
i18n_test_preferredlanguage_0820
'
+
'
start
'
);
let
value
=
I18n
.
addPreferredLanguage
(
'
ja
'
);
console
.
log
(
'
i18n_test_preferredlanguage_0500
'
+
value
);
expect
(
value
).
assertTrue
();
let
value2
=
I18n
.
removePreferredLanguage
(
-
1
);
console
.
log
(
'
i18n_test_preferredlanguage_0820
'
+
value2
);
expect
(
value2
).
assertTrue
();
let
list
=
I18n
.
getPreferredLanguageList
();
console
.
log
(
'
i18n_test_preferredlanguage_0820
'
+
list
);
expect
(
list
.
length
).
assertLarger
(
0
);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_PREFERREDLANGUAGE_0900
* @tc.name test the removePreferredLanguage interface with 0 param
* @tc.desc check the value of removePreferredLanguage method
*/
it
(
'
i18n_test_preferredlanguage_0900
'
,
0
,
function
()
{
console
.
log
(
'
i18n_test_preferredlanguage_0900
'
+
'
start
'
);
let
list
=
I18n
.
getPreferredLanguageList
();
console
.
log
(
'
i18n_test_preferredlanguage_0900
'
+
list
);
let
len
=
list
.
length
;
console
.
log
(
'
i18n_test_preferredlanguage_0900
'
+
len
);
expect
(
len
).
assertLarger
(
0
);
let
parm
=
len
-
1
;
console
.
log
(
'
i18n_test_preferredlanguage_0900
'
+
parm
);
let
value
=
I18n
.
removePreferredLanguage
(
parm
);
console
.
log
(
'
i18n_test_preferredlanguage_0900
'
+
value
);
expect
(
value
).
assertFalse
();
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_PREFERREDLANGUAGE_0920
* @tc.name test the addPreferredLanguage interface with it param
* @tc.desc check the value of addPreferredLanguage method
*/
it
(
'
i18n_test_preferredlanguage_0920
'
,
0
,
function
()
{
console
.
log
(
'
i18n_test_preferredlanguage_0920
'
+
'
start
'
);
let
list
=
I18n
.
getPreferredLanguageList
();
console
.
log
(
'
i18n_test_preferredlanguage_0920
'
+
list
);
let
isContain
=
isContainLang
(
list
,
'
it
'
)
console
.
log
(
'
i18n_test_preferredlanguage_0920
'
+
isContain
);
let
len
=
list
.
length
;
console
.
log
(
'
i18n_test_preferredlanguage_0920
'
+
len
);
expect
(
len
).
assertLarger
(
0
);
if
(
!
isContain
)
{
let
value
=
I18n
.
addPreferredLanguage
(
'
it
'
);
console
.
log
(
'
i18n_test_preferredlanguage_0920
'
+
value
);
expect
(
value
).
assertTrue
();
}
let
list2
=
I18n
.
getPreferredLanguageList
();
console
.
log
(
'
i18n_test_preferredlanguage_0920
'
+
list2
);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_PREFERREDLANGUAGE_0940
* @tc.name test the mixed interface with preferredlanguage
* @tc.desc check the value of preferredLanguage method
*/
it
(
'
i18n_test_preferredlanguage_0940
'
,
0
,
function
()
{
console
.
log
(
'
i18n_test_preferredlanguage_0940
'
+
'
start
'
);
let
value
=
I18n
.
addPreferredLanguage
(
'
it
'
);
console
.
log
(
'
i18n_test_preferredlanguage_0940
'
+
value
);
expect
(
value
).
assertTrue
();
let
value2
=
I18n
.
addPreferredLanguage
(
'
ko
'
);
console
.
log
(
'
i18n_test_preferredlanguage_0940
'
+
value2
);
expect
(
value2
).
assertTrue
();
let
value3
=
I18n
.
addPreferredLanguage
(
'
th
'
);
console
.
log
(
'
i18n_test_preferredlanguage_0940
'
+
value3
);
expect
(
value3
).
assertTrue
();
let
list1
=
I18n
.
getPreferredLanguageList
();
console
.
log
(
'
i18n_test_preferredlanguage_0940
'
+
list1
);
let
value4
=
I18n
.
addPreferredLanguage
(
'
it
'
,
3
);
console
.
log
(
'
i18n_test_preferredlanguage_0940
'
+
value4
);
expect
(
value4
).
assertTrue
();
let
value5
=
I18n
.
addPreferredLanguage
(
'
ko
'
,
2
);
console
.
log
(
'
i18n_test_preferredlanguage_0940
'
+
value5
);
expect
(
value5
).
assertTrue
();
let
value6
=
I18n
.
addPreferredLanguage
(
'
th
'
,
1
);
console
.
log
(
'
i18n_test_preferredlanguage_0940
'
+
value6
);
expect
(
value6
).
assertFalse
();
let
list2
=
I18n
.
getPreferredLanguageList
();
console
.
log
(
'
i18n_test_preferredlanguage_0940
'
+
list2
);
expect
(
list2
[
1
]).
assertEqual
(
'
th
'
);
expect
(
list2
[
2
]).
assertEqual
(
'
ko
'
);
expect
(
list2
[
3
]).
assertEqual
(
'
it
'
);
let
remove1
=
I18n
.
removePreferredLanguage
(
1
);
console
.
log
(
'
i18n_test_preferredlanguage_0940
'
+
remove1
);
expect
(
remove1
).
assertTrue
();
let
list3
=
I18n
.
getPreferredLanguageList
();
console
.
log
(
'
i18n_test_preferredlanguage_0940
'
+
list3
);
expect
(
list3
[
1
]).
assertEqual
(
'
ko
'
);
expect
(
list3
[
2
]).
assertEqual
(
'
it
'
);
let
remove2
=
I18n
.
removePreferredLanguage
(
1
);
console
.
log
(
'
i18n_test_preferredlanguage_0940
'
+
remove2
);
expect
(
remove2
).
assertTrue
();
let
list4
=
I18n
.
getPreferredLanguageList
();
console
.
log
(
'
i18n_test_preferredlanguage_0940
'
+
list4
);
expect
(
list4
[
1
]).
assertEqual
(
'
it
'
);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_PREFERREDLANGUAGE_1000
* @tc.name test the getFirstPreferredLanguage interface
...
...
@@ -567,7 +188,7 @@ describe('LangTest', function () {
let
timezone
=
I18n
.
getTimeZone
();
let
value
=
timezone
.
getID
();
console
.
log
(
'
timezone_test_0100
'
+
value
);
expect
(
value
).
assertEqual
(
'
UTC
'
);
expect
(
value
==
'
UTC
'
||
value
==
'
Asia/Shanghai
'
).
assertTrue
(
);
})
/* *
...
...
@@ -580,7 +201,7 @@ describe('LangTest', function () {
let
timezone
=
I18n
.
getTimeZone
();
let
value
=
timezone
.
getDisplayName
();
console
.
log
(
'
timezone_test_0200
'
+
value
);
expect
(
value
).
assertEqual
(
'
GMT
'
);
expect
(
value
==
'
GMT
'
||
value
==
'
中国标准时间
'
).
assertTrue
(
);
})
/* *
...
...
@@ -593,7 +214,7 @@ describe('LangTest', function () {
let
timezone
=
I18n
.
getTimeZone
();
let
value
=
timezone
.
getDisplayName
(
'
zh-CN
'
);
console
.
log
(
'
timezone_test_0300
'
+
value
);
expect
(
value
).
assertEqual
(
'
GMT
'
);
expect
(
value
==
'
GMT
'
||
value
==
'
中国标准时间
'
).
assertTrue
(
);
})
/* *
...
...
@@ -606,7 +227,7 @@ describe('LangTest', function () {
let
timezone
=
I18n
.
getTimeZone
();
let
value
=
timezone
.
getDisplayName
(
true
);
console
.
log
(
'
timezone_test_0400
'
+
value
);
expect
(
value
).
assertEqual
(
'
GMT
'
);
expect
(
value
==
'
GMT
'
||
value
==
'
中国标准时间
'
).
assertTrue
(
);
})
/* *
...
...
@@ -619,7 +240,7 @@ describe('LangTest', function () {
let
timezone
=
I18n
.
getTimeZone
();
let
value
=
timezone
.
getDisplayName
(
false
);
console
.
log
(
'
timezone_test_0500
'
+
value
);
expect
(
value
).
assertEqual
(
'
GMT
'
);
expect
(
value
==
'
GMT
'
||
value
==
'
中国标准时间
'
).
assertTrue
(
);
})
/* *
...
...
global/perf/perfjs/src/main/js/default/test/Perf.test.js
浏览文件 @
51610151
...
...
@@ -33,40 +33,6 @@ describe('PerfTest', function () {
return
value
;
}
/* *
* clear the preferred language list if exists
*/
function
clearLang
(
langList
){
let
len
=
langList
.
length
;
while
(
len
>
0
){
console
.
log
(
'
i18n_test_preferredlanguage_clearLang
'
+
len
);
let
par
=
len
-
1
;
console
.
log
(
'
i18n_test_preferredlanguage_clearLang
'
+
par
);
let
value
=
I18n
.
removePreferredLanguage
(
par
);
console
.
log
(
'
i18n_test_preferredlanguage_clearLang
'
+
value
);
len
--
;
}
console
.
log
(
'
i18n_test_preferredlanguage_clearLang
'
+
I18n
.
getPreferredLanguageList
());
}
/* *
* execute this step after every testcase
*/
function
restoreLang
(){
for
(
let
j
=
0
;
j
<
initLen
;
j
++
){
let
value
=
I18n
.
addPreferredLanguage
(
initPreferredLang
[
j
],
j
);
console
.
log
(
'
i18n_test_preferredlanguage_restoreLang
'
+
value
);
expect
(
value
).
assertTrue
();
}
let
currLen
=
getCurrentPreferredLang
().
length
;
while
(
currLen
>
initLen
)
{
let
rem
=
I18n
.
removePreferredLanguage
(
currLen
-
1
);
console
.
log
(
'
i18n_test_preferredlanguage_restoreLang
'
+
rem
);
currLen
--
;
}
console
.
log
(
'
i18n_test_preferredlanguage_restoreLang
'
+
I18n
.
getPreferredLanguageList
());
}
/* *
* execute this step before all testcases
*/
...
...
@@ -92,8 +58,6 @@ describe('PerfTest', function () {
console
.
log
(
'
step after every case in perf.
'
);
let
currLang
=
getCurrentPreferredLang
();
console
.
log
(
'
i18n_test_preferredlanguage_afterEach
'
+
currLang
);
clearLang
(
currLang
);
restoreLang
();
})
/* *
...
...
@@ -1354,33 +1318,6 @@ describe('PerfTest', function () {
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_5400
* @tc.name test the performance of set24HourClock
* @tc.desc check the performance of set24HourClock
*/
it
(
'
perf_test_5400
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_5400
'
+
'
start
'
);
let
value
=
false
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
I18n
.
set24HourClock
(
true
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_5400--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
I18n
.
set24HourClock
(
hour
);
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_5500
* @tc.name test the performance of getPreferredLanguageList
...
...
@@ -1433,58 +1370,6 @@ describe('PerfTest', function () {
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_5700
* @tc.name test the performance of addPreferredLanguage
* @tc.desc check the performance of addPreferredLanguage
*/
it
(
'
perf_test_5700
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_5700
'
+
'
start
'
);
let
value
=
false
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
I18n
.
addPreferredLanguage
(
'
it
'
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_5700--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_5800
* @tc.name test the performance of removePreferredLanguage
* @tc.desc check the performance of removePreferredLanguage
*/
it
(
'
perf_test_5800
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_5800
'
+
'
start
'
);
let
value
=
false
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
I18n
.
removePreferredLanguage
(
0
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_5800--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_5900
* @tc.name test the performance of Locale
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录