提交 f3df7db0 编写于 作者: Y y00314596

add by yangqing3@huawei.com

Signed-off-by: Ny00314596 <yangqing3@huawei.com>
上级 89c83dae
...@@ -52,10 +52,17 @@ describe('LangTest', function () { ...@@ -52,10 +52,17 @@ describe('LangTest', function () {
function restoreLang(){ function restoreLang(){
for(let j = 0; j < initLen; j++){ for(let j = 0; j < initLen; j++){
let value = I18n.addPreferredLanguage(initPreferredLang[j]); let value = I18n.addPreferredLanguage(initPreferredLang[j], j);
console.log('i18n_test_preferredlanguage_restoreLang ' + value); console.log('i18n_test_preferredlanguage_restoreLang ' + value);
expect(value).assertTrue(); 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());
} }
beforeEach(function(){ beforeEach(function(){
...@@ -67,6 +74,7 @@ describe('LangTest', function () { ...@@ -67,6 +74,7 @@ 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);
}) })
/* * /* *
...@@ -78,7 +86,7 @@ describe('LangTest', function () { ...@@ -78,7 +86,7 @@ describe('LangTest', function () {
console.log('i18n_test_clock_0100 ' + 'start'); console.log('i18n_test_clock_0100 ' + 'start');
let value = I18n.is24HourClock(); let value = I18n.is24HourClock();
console.log('i18n_test_clock_0100 ' + value); console.log('i18n_test_clock_0100 ' + value);
expect(value).assertTrue(); expect(value).assertFalse();
}) })
/* * /* *
...@@ -88,12 +96,12 @@ describe('LangTest', function () { ...@@ -88,12 +96,12 @@ describe('LangTest', function () {
*/ */
it('i18n_test_clock_0200', 0, function () { it('i18n_test_clock_0200', 0, function () {
console.log('i18n_test_clock_0200 ' + 'start'); console.log('i18n_test_clock_0200 ' + 'start');
let value = I18n.set24HourClock(false); let value = I18n.set24HourClock(true);
console.log('i18n_test_clock_0200 ' + value); console.log('i18n_test_clock_0200 ' + value);
expect(value).assertTrue(); expect(value).assertTrue();
let value2 = I18n.is24HourClock(); let value2 = I18n.is24HourClock();
console.log('i18n_test_clock_0200 ' + value2); console.log('i18n_test_clock_0200 ' + value2);
expect(value2).assertFalse(); expect(value2).assertTrue();
}) })
/* * /* *
...@@ -103,12 +111,12 @@ describe('LangTest', function () { ...@@ -103,12 +111,12 @@ describe('LangTest', function () {
*/ */
it('i18n_test_clock_0300', 0, function () { it('i18n_test_clock_0300', 0, function () {
console.log('i18n_test_clock_0300 ' + 'start'); console.log('i18n_test_clock_0300 ' + 'start');
let value = I18n.set24HourClock(true); let value = I18n.set24HourClock(false);
console.log('i18n_test_clock_0300 ' + value); console.log('i18n_test_clock_0300 ' + value);
expect(value).assertTrue(); expect(value).assertTrue();
let value2 = I18n.is24HourClock(); let value2 = I18n.is24HourClock();
console.log('i18n_test_clock_0300 ' + value2); console.log('i18n_test_clock_0300 ' + value2);
expect(value).assertTrue(); expect(value2).assertFalse();
}) })
/* * /* *
...@@ -269,7 +277,7 @@ describe('LangTest', function () { ...@@ -269,7 +277,7 @@ describe('LangTest', function () {
console.log('i18n_test_preferredlanguage_0700 ' + 'start'); console.log('i18n_test_preferredlanguage_0700 ' + 'start');
let value = I18n.removePreferredLanguage(0); let value = I18n.removePreferredLanguage(0);
console.log('i18n_test_preferredlanguage_0700 ' + value); console.log('i18n_test_preferredlanguage_0700 ' + value);
expect(value).assertTrue(); expect(value).assertFalse();
let list = I18n.getPreferredLanguageList(); let list = I18n.getPreferredLanguageList();
console.log('i18n_test_preferredlanguage_0700 ' + list); console.log('i18n_test_preferredlanguage_0700 ' + list);
expect(list.length).assertLarger(0); expect(list.length).assertLarger(0);
...@@ -299,12 +307,30 @@ describe('LangTest', function () { ...@@ -299,12 +307,30 @@ describe('LangTest', function () {
console.log('i18n_test_preferredlanguage_0800 ' + 'start'); console.log('i18n_test_preferredlanguage_0800 ' + 'start');
let value = I18n.removePreferredLanguage(-1); let value = I18n.removePreferredLanguage(-1);
console.log('i18n_test_preferredlanguage_0800 ' + value); console.log('i18n_test_preferredlanguage_0800 ' + value);
expect(value).assertTrue(); expect(value).assertFalse();
let list = I18n.getPreferredLanguageList(); let list = I18n.getPreferredLanguageList();
console.log('i18n_test_preferredlanguage_0800 ' + list); console.log('i18n_test_preferredlanguage_0800 ' + list);
expect(list.length).assertLarger(0); expect(list.length).assertLarger(0);
}) })
/* *
* @tc.number SUB_GLOBAL_I18N_JS_PREFERREDLANGUAGE_0820
* @tc.name test the removePreferredLanguage interface with -1 param
* @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.number SUB_GLOBAL_I18N_JS_PREFERREDLANGUAGE_0900
* @tc.name test the addPreferredLanguage interface * @tc.name test the addPreferredLanguage interface
...@@ -318,9 +344,10 @@ describe('LangTest', function () { ...@@ -318,9 +344,10 @@ describe('LangTest', function () {
console.log('i18n_test_preferredlanguage_0900 ' + len); console.log('i18n_test_preferredlanguage_0900 ' + len);
expect(len).assertLarger(0); expect(len).assertLarger(0);
let parm = len - 1; let parm = len - 1;
console.log('i18n_test_preferredlanguage_0900 ' + parm);
let value = I18n.removePreferredLanguage(parm); let value = I18n.removePreferredLanguage(parm);
console.log('i18n_test_preferredlanguage_0900 ' + value); console.log('i18n_test_preferredlanguage_0900 ' + value);
expect(value).assertTrue(); expect(value).assertFalse();
}) })
/* * /* *
...@@ -371,7 +398,7 @@ describe('LangTest', function () { ...@@ -371,7 +398,7 @@ describe('LangTest', function () {
expect(value5).assertTrue(); expect(value5).assertTrue();
let value6 = I18n.addPreferredLanguage('en', 1); let value6 = I18n.addPreferredLanguage('en', 1);
console.log('i18n_test_preferredlanguage_0940 ' + value6); console.log('i18n_test_preferredlanguage_0940 ' + value6);
expect(value6).assertTrue(); expect(value6).assertFalse();
let list2 = I18n.getPreferredLanguageList(); let list2 = I18n.getPreferredLanguageList();
console.log('i18n_test_preferredlanguage_0940 ' + list2); console.log('i18n_test_preferredlanguage_0940 ' + list2);
expect(list2[1]).assertEqual('en'); expect(list2[1]).assertEqual('en');
...@@ -397,15 +424,15 @@ describe('LangTest', function () { ...@@ -397,15 +424,15 @@ describe('LangTest', function () {
* @tc.name test the addPreferredLanguage interface * @tc.name test the addPreferredLanguage interface
* @tc.desc check the value of addPreferredLanguage method * @tc.desc check the value of addPreferredLanguage method
*/ */
// it('i18n_test_preferredlanguage_1000', 0, function () { it('i18n_test_preferredlanguage_1000', 0, function () {
// console.log('i18n_test_preferredlanguage_1000 ' + 'start'); console.log('i18n_test_preferredlanguage_1000 ' + 'start');
// let value = I18n.getFirstPreferredLanguage(); let value = I18n.getFirstPreferredLanguage();
// console.log('i18n_test_preferredlanguage_1000 ' + value); console.log('i18n_test_preferredlanguage_1000 ' + value);
// expect(value).assertEqual('en'); expect(value).assertEqual('zh-Hans');
// let list = I18n.getPreferredLanguageList(); let list = I18n.getPreferredLanguageList();
// console.log('i18n_test_preferredlanguage_1000 ' + list); console.log('i18n_test_preferredlanguage_1000 ' + list);
// expect(list.length).assertLarger(0); expect(list.length).assertLarger(0);
// }) })
console.log('*************end LangTest*************'); console.log('*************end LangTest*************');
}) })
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册