未验证 提交 491f041b 编写于 作者: O openharmony_ci 提交者: Gitee

!2368 sync perf cases to 3.1 rls

Merge pull request !2368 from 杨清/cherry-pick-1646988161
...@@ -81,6 +81,7 @@ describe('LangTest', function () { ...@@ -81,6 +81,7 @@ describe('LangTest', function () {
* execute this step before every testcase * execute this step before every testcase
*/ */
beforeEach(function(){ beforeEach(function(){
I18n.set24HourClock(false);
console.log('i18n_test_preferredlanguage_beforeEach ' + getCurrentPreferredLang()); console.log('i18n_test_preferredlanguage_beforeEach ' + getCurrentPreferredLang());
}) })
...@@ -92,7 +93,6 @@ describe('LangTest', function () { ...@@ -92,7 +93,6 @@ describe('LangTest', function () {
console.log('i18n_test_preferredlanguage_afterEach ' + currLang); console.log('i18n_test_preferredlanguage_afterEach ' + currLang);
clearLang(currLang); clearLang(currLang);
restoreLang(); restoreLang();
I18n.set24HourClock(false);
}) })
/* * /* *
......
...@@ -21,17 +21,72 @@ describe('PerfTest', function () { ...@@ -21,17 +21,72 @@ describe('PerfTest', function () {
console.log('*************start PerfTest*************'); console.log('*************start PerfTest*************');
let EXETIME = 1000; let EXETIME = 1000;
let initPreferredLang = I18n.getPreferredLanguageList();
let initLen = initPreferredLang.length;
/* *
* get the current preferred language list
*/
function getCurrentPreferredLang(){
let value = I18n.getPreferredLanguageList();
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());
}
beforeAll(function(){ beforeAll(function(){
console.log('step before all cases.'); console.log('step before all cases.');
}) })
/* *
* execute this step before every testcase
*/
beforeEach(function(){ beforeEach(function(){
console.log('step before every case.'); console.log('step before every case.');
console.log('i18n_test_preferredlanguage_beforeEach ' + getCurrentPreferredLang());
}) })
/* *
* execute this step after every testcase
*/
afterEach(function(){ afterEach(function(){
console.log('step after every case.'); console.log('step after every case.');
let currLang = getCurrentPreferredLang();
console.log('i18n_test_preferredlanguage_afterEach ' + currLang);
clearLang(currLang);
restoreLang();
}) })
afterAll(function(){ afterAll(function(){
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册