提交 7fb7368f 编写于 作者: Y y00314596

add by yangqing3@huawei.com

Signed-off-by: Ny00314596 <yangqing3@huawei.com>
上级 33e7a30c
......@@ -58,462 +58,6 @@ describe('intlTest', function () {
+ ' syslocale: ' + I18n.getSystemLocale());
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_LOCALE_0100
* @tc.name test the language in en-Latn-GB locale
* @tc.desc check the language
*/
it('locale_test_0100', 0, function () {
let locale = new Intl.Locale('en-Latn-GB');
console.log('locale_test_0100 ' + locale.language);
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_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
* @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
* @tc.desc check the language
*/
it('locale_test_0200', 0, function () {
let locale = new Intl.Locale('ja-Jpan-JP-u-ca-japanese-hc-h12-co-emoji');
console.log('locale_test_0200 ' + locale.language);
expect(locale.language).assertEqual('ja');
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_LOCALE_0300
* @tc.name test the script in locale
* @tc.desc check the script
*/
it('locale_test_0300', 0, function () {
let locale = new Intl.Locale('en-Latn-GB');
console.log('locale_test_0300 ' + locale.script);
expect(locale.script).assertEqual('Latn');
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_LOCALE_0400
* @tc.name test the region in locale
* @tc.desc check the region
*/
it('locale_test_0400', 0, function () {
let locale = new Intl.Locale('en-Latn-GB');
console.log('locale_test_0400 ' + locale.region);
expect(locale.region).assertEqual('GB');
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_LOCALE_0500
* @tc.name test the basename in locale
* @tc.desc check the basename
*/
it('locale_test_0500', 0, function () {
let locale = new Intl.Locale('en-Latn-GB');
console.log('locale_test_0500 ' + locale.baseName);
expect(locale.baseName).assertEqual('en-Latn-GB');
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_LOCALE_0600
* @tc.name test the basename in ja-Jpan-JP-u-ca-japanese-hc-h12
* @tc.desc check the ja-Jpan-JP-u-ca-japanese-hc-h12 basename
*/
it('locale_test_0600', 0, function () {
let locale = new Intl.Locale('ja-Jpan-JP-u-ca-japanese-hc-h12');
console.log('locale_test_0600 ' + locale.baseName);
expect(locale.baseName).assertEqual('ja-Jpan-JP');
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_LOCALE_0700
* @tc.name test the hourCycle
* @tc.desc check the hourCycle
*/
it('locale_test_0700', 0, function () {
let locale = new Intl.Locale('zh-CN', {hourCycle: 'h24', calendar: 'gregory'});
console.log('locale_test_0700 ' + locale.hourCycle);
expect(locale.hourCycle).assertEqual('h24');
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_LOCALE_0800
* @tc.name test the calendar
* @tc.desc check the calendar
*/
it('locale_test_0800', 0, function () {
let locale = new Intl.Locale('zh-CN', {hourCycle: 'h24', calendar: 'gregory'});
console.log('locale_test_0800 ' + locale.calendar);
expect(locale.calendar).assertEqual('gregory');
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_LOCALE_0900
* @tc.name test the japanese calendar
* @tc.desc check the japanese calendar
*/
it('locale_test_0900', 0, function () {
let locale = new Intl.Locale('ja-Jpan-JP-u-ca-japanese-hc-h12');
console.log('locale_test_0900 ' + locale.calendar);
expect(locale.calendar).assertEqual('japanese');
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_LOCALE_1000
* @tc.name test the h12 hourCycle
* @tc.desc check the h12 hourCycle
*/
it('locale_test_1000', 0, function () {
let locale = new Intl.Locale('ja-Jpan-JP-u-ca-japanese-hc-h12');
console.log('locale_test_1000 ' + locale.hourCycle);
expect(locale.hourCycle).assertEqual('h12');
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_LOCALE_1100
* @tc.name test the caseFirst with upper
* @tc.desc check the caseFirst
*/
it('locale_test_1100', 0, function () {
let locale = new Intl.Locale('ja-Jpan-JP', {caseFirst: 'upper'});
console.log('locale_test_1100 ' + locale.caseFirst);
expect(locale.caseFirst).assertEqual('upper');
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_LOCALE_1120
* @tc.name test the caseFirst with lower
* @tc.desc check the caseFirst
*/
it('locale_test_1120', 0, function () {
let locale = new Intl.Locale('ja-Jpan-JP', {caseFirst: 'lower'});
console.log('locale_test_1120 ' + locale.caseFirst);
expect(locale.caseFirst).assertEqual('lower');
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_LOCALE_1140
* @tc.name test the caseFirst with false
* @tc.desc check the caseFirst
*/
it('locale_test_1140', 0, function () {
let locale = new Intl.Locale('ja-Jpan-JP', {caseFirst: 'false'});
console.log('locale_test_1140 ' + locale.caseFirst);
expect(locale.caseFirst).assertEqual('false');
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_LOCALE_1200
* @tc.name test the collation
* @tc.desc check the collation
*/
it('locale_test_1200', 0, function () {
let locale = new Intl.Locale('ja-Jpan-JP', {collation: 'big5han'});
console.log('locale_test_1200 ' + locale.collation);
expect(locale.collation).assertEqual('big5han');
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_LOCALE_1300
* @tc.name test the numeric with true value
* @tc.desc check the numeric
*/
it('locale_test_1300', 0, function () {
let locale = new Intl.Locale('ja-Jpan-JP', {numeric: true});
console.log('locale_test_1300 ' + locale.numeric);
expect(locale.numeric).assertTrue();
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_LOCALE_1350
* @tc.name test the numeric with false value
* @tc.desc check the numeric
*/
it('locale_test_1350', 0, function () {
let locale = new Intl.Locale('ja-Jpan-JP', {numeric: false});
console.log('locale_test_1350 ' + locale.numeric);
expect(locale.numeric).assertFalse();
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_LOCALE_1400
* @tc.name test the numberingSystem
* @tc.desc check the numberingSystem
*/
it('locale_test_1400', 0, function () {
let locale = new Intl.Locale('ja-Jpan-JP', {numberingSystem: 'arab'});
console.log('locale_test_1400 ' + locale.numberingSystem);
expect(locale.numberingSystem).assertEqual('arab');
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_LOCALE_1500
* @tc.name test the toString interface with zh
* @tc.desc check the toString method with zh
*/
it('locale_test_1500', 0, function () {
let locale = new Intl.Locale('zh');
console.log('locale_test_1500 ' + locale.toString());
expect(locale.toString()).assertEqual('zh');
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_LOCALE_1600
* @tc.name test the toString interface with zh-CN
* @tc.desc check the toString method with zh-CN
*/
it('locale_test_1600', 0, function () {
let locale = new Intl.Locale('zh-CN');
console.log('locale_test_1600 ' + locale.toString());
expect(locale.toString()).assertEqual('zh-CN');
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_LOCALE_1700
* @tc.name test the toString interface with zh-Hans-CN
* @tc.desc check the toString method with zh-Hans-CN
*/
it('locale_test_1700', 0, function () {
let locale = new Intl.Locale('zh-Hans-CN');
console.log('locale_test_1700 ' + locale.toString());
expect(locale.toString()).assertEqual('zh-Hans-CN');
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_LOCALE_1800
* @tc.name test the toString interface with zh-Hans-CN-u-hc-h12-ca-japanese
* @tc.desc check the toString method with zh-Hans-CN-u-hc-h12-ca-japanese
*/
it('locale_test_1800', 0, function () {
let locale = new Intl.Locale('zh-Hans-CN-u-ca-japanese-hc-h12');
console.log('locale_test_1800 ' + locale.toString());
expect(locale.toString()).assertEqual('zh-Hans-CN-u-hc-h12-ca-japanese');
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_LOCALE_1900
* @tc.name test the maximize interface with zh-u-ca-gregory-co-compact param
* @tc.desc check the maximize method with zh-u-ca-gregory-co-compact param
*/
it('locale_test_1900', 0, function () {
let locale = new Intl.Locale('zh', {calendar: 'gregory', collation: 'compact'});
console.log('locale_test_1900 ' + locale.toString());
expect(locale.toString()).assertEqual('zh-u-ca-gregory-co-compact');
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_LOCALE_2000
* @tc.name test the toString interface with zh-CN-u-ca-gregory-co-compact param
* @tc.desc check the toString method with zh-CN-u-ca-gregory-co-compact param
*/
it('locale_test_2000', 0, function () {
let locale = new Intl.Locale('zh-CN', {calendar: 'gregory', collation: 'compact'});
console.log('locale_test_2000 ' + locale.toString());
expect(locale.toString()).assertEqual('zh-CN-u-ca-gregory-co-compact');
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_LOCALE_2100
* @tc.name test the toString interface with zh-hans-CN-u-ca-gregory-co-compact param
* @tc.desc check the toString method with zh-hans-CN-u-ca-gregory-co-compact param
*/
it('locale_test_2100', 0, function () {
let locale = new Intl.Locale('zh-hans-CN', {calendar: 'gregory', collation: 'compact'});
console.log('locale_test_2100 ' + locale.toString());
expect(locale.toString()).assertEqual('zh-hans-CN-u-ca-gregory-co-compact');
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_LOCALE_2200
* @tc.name test the minimize interface with one param zh
* @tc.desc check the minimize method with one param zh
*/
it('locale_test_2200', 0, function () {
let locale = new Intl.Locale('zh');
console.log('locale_test_2200 ' + locale.minimize().toString());
expect(locale.minimize().toString()).assertEqual('zh');
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_LOCALE_2201
* @tc.name test the minimize interface with one param zh-CN
* @tc.desc check the minimize method with one param zh-CN
*/
it('locale_test_2201', 0, function () {
let locale = new Intl.Locale('zh-CN');
console.log('locale_test_2201 ' + locale.minimize().toString());
expect(locale.minimize().toString()).assertEqual('zh');
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_LOCALE_2202
* @tc.name test the minimize interface with one param zh-Hans-CN
* @tc.desc check the minimize method with one param zh-Hans-CN
*/
it('locale_test_2202', 0, function () {
let locale = new Intl.Locale('zh-Hans-CN');
console.log('locale_test_2202 ' + locale.minimize().toString());
expect(locale.minimize().toString()).assertEqual('zh');
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_LOCALE_2203
* @tc.name test the minimize interface with one param zh-Hans-CN-u-ca-gregory-co-compact
* @tc.desc check the minimize method with one param zh-Hans-CN-u-ca-gregory-co-compact
*/
it('locale_test_2203', 0, function () {
let locale = new Intl.Locale('zh-Hans-CN-u-ca-gregory-co-compact');
console.log('locale_test_2203 ' + locale.minimize().toString());
expect(locale.minimize().toString()).assertEqual('zh-u-ca-gregory-co-compact');
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_LOCALE_2204
* @tc.name test the minimize interface with zh lcoale
* @tc.desc check the minimize method with zh lcoale
*/
it('locale_test_2204', 0, function () {
let locale = new Intl.Locale('zh', {calendar: 'gregory', collation: 'compact'});
console.log('locale_test_2204 ' + locale.minimize().toString());
expect(locale.minimize().toString()).assertEqual('zh-u-ca-gregory-co-compact');
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_LOCALE_2205
* @tc.name test the minimize interface with zh-CN lcoale
* @tc.desc check the minimize method with zh-CN lcoale
*/
it('locale_test_2205', 0, function () {
let locale = new Intl.Locale('zh-CN', {calendar: 'gregory', collation: 'compact'});
console.log('locale_test_2205 ' + locale.minimize().toString());
expect(locale.minimize().toString()).assertEqual('zh-u-ca-gregory-co-compact');
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_LOCALE_2206
* @tc.name test the minimize interface with zh-Hans-CN lcoale
* @tc.desc check the minimize method with zh-Hans-CN lcoale
*/
it('locale_test_2206', 0, function () {
let locale = new Intl.Locale('zh-hans-CN', {calendar: 'gregory', collation: 'compact'});
console.log('locale_test_2206 ' + locale.minimize().toString());
expect(locale.minimize().toString()).assertEqual('zh-u-ca-gregory-co-compact');
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_LOCALE_2300
* @tc.name test the maximize interface with one param zh
* @tc.desc check the maximize method with one param zh
*/
it('locale_test_2300', 0, function () {
let locale = new Intl.Locale('zh');
console.log('locale_test_2300 ' + locale.maximize().toString());
expect(locale.maximize().toString()).assertEqual('zh-Hans-CN');
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_LOCALE_2301
* @tc.name test the maximize interface with one param zh-CN
* @tc.desc check the maximize method with one param zh-CN
*/
it('locale_test_2301', 0, function () {
let locale = new Intl.Locale('zh-CN');
console.log('locale_test_2301 ' + locale.maximize().toString());
expect(locale.maximize().toString()).assertEqual('zh-Hans-CN');
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_LOCALE_2302
* @tc.name test the maximize interface with one param zh-Hans-CN-u-ca-gregory-co-compact
* @tc.desc check the maximize method with one param zh-Hans-CN-u-ca-gregory-co-compact
*/
it('locale_test_2302', 0, function () {
let locale = new Intl.Locale('zh-Hans-CN');
console.log('locale_test_2302 ' + locale.maximize().toString());
expect(locale.maximize().toString()).assertEqual('zh-Hans-CN');
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_LOCALE_2303
* @tc.name test the maximize interface with zh-Hans-CN-u-ca-gregory-co-compact locale
* @tc.desc check the maximize method with zh-Hans-CN-u-ca-gregory-co-compact locale
*/
it('locale_test_2303', 0, function () {
let locale = new Intl.Locale('zh-Hans-CN-u-ca-gregory-co-compact');
console.log('locale_test_2303 ' + locale.maximize().toString());
expect(locale.maximize().toString()).assertEqual('zh-Hans-CN-u-ca-gregory-co-compact');
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_LOCALE_2304
* @tc.name test the maximize interface with zh locale
* @tc.desc check the maximize method with zh locale
*/
it('locale_test_2304', 0, function () {
let locale = new Intl.Locale('zh', {calendar: 'gregory', collation: 'compact'});
console.log('locale_test_2304 ' + locale.maximize().toString());
expect(locale.maximize().toString()).assertEqual('zh-Hans-CN-u-ca-gregory-co-compact');
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_LOCALE_2305
* @tc.name test the maximize interface with zh-CN locale
* @tc.desc check the maximize method with zh-CN locale
*/
it('locale_test_2305', 0, function () {
let locale = new Intl.Locale('zh-CN', {calendar: 'gregory', collation: 'compact'});
console.log('locale_test_2305 ' + locale.maximize().toString());
expect(locale.maximize().toString()).assertEqual('zh-Hans-CN-u-ca-gregory-co-compact');
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_LOCALE_2306
* @tc.name test the maximize interface with zh-Hans-CN locale
* @tc.desc check the maximize method with zh-Hans-CN locale
*/
it('locale_test_2306', 0, function () {
let locale = new Intl.Locale('zh-Hans-CN', {calendar: 'gregory', collation: 'compact'});
console.log('locale_test_2306 ' + locale.maximize().toString());
expect(locale.maximize().toString()).assertEqual('zh-Hans-CN-u-ca-gregory-co-compact');
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_DATETIME_0100
* @tc.name format the datetime with en-GB locale
......
......@@ -303,323 +303,6 @@ describe('LangTest', function () {
expect(value).assertEqual('the sky is in blue-style!');
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_TIMEZONE_0100
* @tc.name test getTimeZone method
* @tc.desc get the getTimeZone value
*/
it('timezone_test_0100', 0, function () {
console.log('timezone_test_0100 ' + 'start');
let timezone = I18n.getTimeZone();
let value = timezone.getID();
console.log('timezone_test_0100 ' + value);
expect(value.length > 0).assertTrue();
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_TIMEZONE_0200
* @tc.name test getDisplayName method
* @tc.desc get the getDisplayName value
*/
it('timezone_test_0200', 0, function () {
console.log('timezone_test_0200 ' + 'start');
let timezone = I18n.getTimeZone();
let value = timezone.getDisplayName();
console.log('timezone_test_0200 ' + value);
expect(value.length > 0).assertTrue();
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_TIMEZONE_0300
* @tc.name test getDisplayName method with zh-CN param
* @tc.desc get the getDisplayName value
*/
it('timezone_test_0300', 0, function () {
console.log('timezone_test_0300 ' + 'start');
let timezone = I18n.getTimeZone();
let value = timezone.getDisplayName('zh-CN');
console.log('timezone_test_0300 ' + value);
expect(value.length > 0).assertTrue();
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_TIMEZONE_0400
* @tc.name test getDisplayName method with true param
* @tc.desc get the getDisplayName value
*/
it('timezone_test_0400', 0, function () {
console.log('timezone_test_0400 ' + 'start');
let timezone = I18n.getTimeZone();
let value = timezone.getDisplayName(true);
console.log('timezone_test_0400 ' + value);
expect(value.length > 0).assertTrue();
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_TIMEZONE_0500
* @tc.name test getDisplayName method with false param
* @tc.desc get the getDisplayName value
*/
it('timezone_test_0500', 0, function () {
console.log('timezone_test_0500 ' + 'start');
let timezone = I18n.getTimeZone();
let value = timezone.getDisplayName(false);
console.log('timezone_test_0500 ' + value);
expect(value.length > 0).assertTrue();
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_TIMEZONE_0600
* @tc.name test getRawOffset method
* @tc.desc get the getRawOffset value
*/
it('timezone_test_0600', 0, function () {
console.log('timezone_test_0600 ' + 'start');
let timezone = I18n.getTimeZone();
let value = timezone.getRawOffset();
console.log('timezone_test_0600 ' + value);
expect(value >= 0).assertEqual(true);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_TIMEZONE_0700
* @tc.name test getOffset method
* @tc.desc get the getOffset value
*/
it('timezone_test_0700', 0, function () {
console.log('timezone_test_0700 ' + 'start');
let timezone = I18n.getTimeZone();
let value = timezone.getOffset();
console.log('timezone_test_0700 ' + value);
expect(value >= 0).assertEqual(true);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_TIMEZONE_0800
* @tc.name test getOffset method with date param
* @tc.desc get the getOffset value
*/
it('timezone_test_0800', 0, function () {
console.log('timezone_test_0800 ' + 'start');
let timezone = I18n.getTimeZone();
let value = timezone.getOffset(10540800000);
console.log('timezone_test_0800 ' + value);
expect(value >= 0).assertEqual(true);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_TIMEZONE_0900
* @tc.name test getID
* @tc.desc get the getID value
*/
it('timezone_test_0900', 0, function () {
console.log('timezone_test_0900 ' + 'start');
let timezone = I18n.getTimeZone('ACT');
let value = timezone.getID();
console.log('timezone_test_0900 ' + value);
expect(value).assertEqual('ACT');
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_TIMEZONE_1000
* @tc.name test getDisplayName with timezone id
* @tc.desc get the getID value
*/
it('timezone_test_1000', 0, function () {
console.log('timezone_test_1000 ' + 'start');
let timezone = I18n.getTimeZone('ACT');
let value = timezone.getDisplayName();
console.log('timezone_test_1000 ' + value);
expect(value).assertEqual('澳大利亚中部标准时间');
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_TIMEZONE_1100
* @tc.name test getDisplayName with locale
* @tc.desc get the getID value
*/
it('timezone_test_1100', 0, function () {
console.log('timezone_test_1100 ' + 'start');
let timezone = I18n.getTimeZone('Asia/Shanghai');
let value = timezone.getDisplayName('zh-CN');
console.log('timezone_test_1100 ' + value);
expect(value).assertEqual('中国标准时间');
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_TIMEZONE_1200
* @tc.name test getDisplayName with locale
* @tc.desc get the getID value
*/
it('timezone_test_1200', 0, function () {
console.log('timezone_test_1200 ' + 'start');
let timezone = I18n.getTimeZone('Asia/Shanghai');
let value = timezone.getDisplayName('zh-CN', true);
console.log('timezone_test_1200 ' + value);
expect(value).assertEqual('中国标准时间');
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_TIMEZONE_1300
* @tc.name test getDisplayName with en-US and true param
* @tc.desc get the getID value
*/
it('timezone_test_1300', 0, function () {
console.log('timezone_test_1300 ' + 'start');
let timezone = I18n.getTimeZone('Asia/Shanghai');
let value = timezone.getDisplayName('en-US', true);
console.log('timezone_test_1300 ' + value);
expect(value).assertEqual('China Standard Time');
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_TIMEZONE_1400
* @tc.name test getDisplayName with zh-CN and false param
* @tc.desc get the getID value
*/
it('timezone_test_1400', 0, function () {
console.log('timezone_test_1400 ' + 'start');
let timezone = I18n.getTimeZone('Asia/Shanghai');
let value = timezone.getDisplayName('zh-CN', false);
console.log('timezone_test_1400 ' + value);
expect(value).assertEqual('中国标准时间');
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_TIMEZONE_1500
* @tc.name test getRawOffset method with timezone id
* @tc.desc get the getRawOffset value
*/
it('timezone_test_1500', 0, function () {
console.log('timezone_test_1500 ' + 'start');
let timezone = I18n.getTimeZone('ACT');
let value = timezone.getRawOffset();
console.log('timezone_test_1500 ' + value);
expect(value > 0).assertEqual(true);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_TIMEZONE_1600
* @tc.name test getOffset method with timezone id
* @tc.desc get the getOffset value
*/
it('timezone_test_1600', 0, function () {
console.log('timezone_test_1600 ' + 'start');
let timezone = I18n.getTimeZone('ACT');
let value = timezone.getOffset();
console.log('timezone_test_1600 ' + value);
expect(value > 0).assertEqual(true);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_TIMEZONE_1700
* @tc.name test getOffset method with date and timezone id param
* @tc.desc get the getOffset value
*/
it('timezone_test_1700', 0, function () {
console.log('timezone_test_1700 ' + 'start');
let timezone = I18n.getTimeZone('ACT');
let value = timezone.getOffset(10540800000);
console.log('timezone_test_1700 ' + value);
expect(value > 0).assertEqual(true);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_TIMEZONE_1800
* @tc.name test getAvailableIDs method
* @tc.desc get the getAvailableIDs value
*/
it('timezone_test_1800', 0, function () {
console.log('timezone_test_1800 ' + 'start');
let value = I18n.TimeZone.getAvailableIDs();
console.log('timezone_test_1800 ' + value);
expect(value.length > 0).assertEqual(true);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_TIMEZONE_1900
* @tc.name test getAvailableZoneCityIDs method
* @tc.desc get the getAvailableZoneCityIDs value
*/
it('timezone_test_1900', 0, function () {
console.log('timezone_test_1900 ' + 'start');
let value = I18n.TimeZone.getAvailableZoneCityIDs();
console.log('timezone_test_1900 ' + value);
expect(value.length > 0).assertEqual(true);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_TIMEZONE_2000
* @tc.name test getCityDisplayName method with zh locale
* @tc.desc get the getCityDisplayName value
*/
it('timezone_test_2000', 0, function () {
console.log('timezone_test_2000 ' + 'start');
let value = I18n.TimeZone.getCityDisplayName('Auckland', 'zh');
console.log('timezone_test_2000 ' + value);
expect(value).assertEqual('奥克兰 (新西兰)');
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_TIMEZONE_2020
* @tc.name test getCityDisplayName method with en loacle
* @tc.desc get the getCityDisplayName value
*/
it('timezone_test_2020', 0, function () {
console.log('timezone_test_2020 ' + 'start');
let value = I18n.TimeZone.getCityDisplayName('Auckland', 'en');
console.log('timezone_test_2020 ' + value);
expect(value).assertEqual('Auckland (New Zealand)');
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_TIMEZONE_2040
* @tc.name test getCityDisplayName method with not exist cityid
* @tc.desc get the getCityDisplayName value
*/
it('timezone_test_2040', 0, function () {
console.log('timezone_test_2040 ' + 'start');
let value = I18n.TimeZone.getCityDisplayName('abcd', 'en');
console.log('timezone_test_2040 ' + value);
expect(value).assertEqual('');
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_TIMEZONE_2060
* @tc.name test getCityDisplayName method with not exist locale
* @tc.desc get the getCityDisplayName value
*/
it('timezone_test_2060', 0, function () {
console.log('timezone_test_2060 ' + 'start');
let value = I18n.TimeZone.getCityDisplayName('Auckland', 'abc');
console.log('timezone_test_2060 ' + value);
expect(value).assertEqual('Auckland (New Zealand)');
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_TIMEZONE_2100
* @tc.name test getTimezoneFromCity method
* @tc.desc get the getTimezoneFromCity value
*/
it('timezone_test_2100', 0, function () {
console.log('timezone_test_2100 ' + 'start');
let value = I18n.TimeZone.getTimezoneFromCity('Auckland');
console.log('timezone_test_2100 ' + value);
expect(value != null).assertTrue();
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_TIMEZONE_2120
* @tc.name test getTimezoneFromCity method with not exist cityid
* @tc.desc get the getTimezoneFromCity value
*/
it('timezone_test_2120', 0, function () {
console.log('timezone_test_2120 ' + 'start');
let value = I18n.TimeZone.getTimezoneFromCity('abc');
console.log('timezone_test_2120 ' + value);
expect(value != null).assertTrue();
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_LOCALDIGIT_0100
* @tc.name test getUsingLocalDigit method
......@@ -631,163 +314,5 @@ describe('LangTest', function () {
expect(value).assertFalse();
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_DATEORDER_0100
* @tc.name test getDateOrder method with zh param
* @tc.desc get the DateOrder value
*/
it('dateorder_test_0100', 0, function () {
console.log('dateorder_test_0100 ' + 'start');
let value = I18n.I18NUtil.getDateOrder('zh');
console.log('dateorder_test_0100 ' + value);
expect(value).assertEqual('y-L-d');
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_DATEORDER_0200
* @tc.name test getDateOrder method with en param
* @tc.desc get the DateOrder value
*/
it('dateorder_test_0200', 0, function () {
console.log('dateorder_test_0200 ' + 'start');
let value = I18n.I18NUtil.getDateOrder('en');
console.log('dateorder_test_0200 ' + value);
expect(value).assertEqual('LLL-d-y');
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_DATEORDER_0300
* @tc.name test getDateOrder method with th param
* @tc.desc get the DateOrder value
*/
it('dateorder_test_0300', 0, function () {
console.log('dateorder_test_0300 ' + 'start');
let value = I18n.I18NUtil.getDateOrder('th');
console.log('dateorder_test_0300 ' + value);
expect(value).assertEqual('d-LLL-y');
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_DATEORDER_0400
* @tc.name test getDateOrder method with jp param
* @tc.desc get the DateOrder value
*/
it('dateorder_test_0400', 0, function () {
console.log('dateorder_test_0400 ' + 'start');
let value = I18n.I18NUtil.getDateOrder('jp');
console.log('dateorder_test_0400 ' + value);
expect(value).assertEqual('LLL-d-y');
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_TRANSLITERATOR_0100
* @tc.name test getAvailableIDs
* @tc.desc get the ID value
*/
it('transliterator_test_0100', 0, function () {
console.log('transliterator_test_0100 ' + 'start');
let value = I18n.Transliterator.getAvailableIDs();
let len = value.length;
console.log('transliterator_test_0100 ' + value);
console.log('transliterator_test_0100 ' + len);
expect(value !== null).assertTrue();
expect(len).assertEqual(671);
while (len > 0)
{
console.log('transliterator_test_0100 ' + value[len-1]);
len--;
}
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_TRANSLITERATOR_0200
* @tc.name test getInstance with a param
* @tc.desc get the instance value
*/
it('transliterator_test_0200', 0, function () {
console.log('transliterator_test_0200 ' + 'start');
let value = I18n.Transliterator.getInstance('a');
console.log('transliterator_test_0200 ' + value);
expect(value !== null).assertTrue();
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_TRANSLITERATOR_0300
* @tc.name test transform with 中国 param
* @tc.desc get the transform value
*/
it('transliterator_test_0300', 0, function () {
console.log('transliterator_test_0300 ' + 'start');
let trans = I18n.Transliterator.getInstance('Any-Accents');
let value = trans.transform('中国');
console.log('transliterator_test_0300 ' + value);
expect(value).assertEqual('中国');
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_TRANSLITERATOR_0400
* @tc.name test transform with Any-Latn param
* @tc.desc get the transform value
*/
it('transliterator_test_0400', 0, function () {
console.log('transliterator_test_0400 ' + 'start');
let trans = I18n.Transliterator.getInstance('Any-Latn');
let value = trans.transform('中国');
console.log('transliterator_test_0400 ' + value);
expect(value).assertEqual('zhōng guó');
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_TRANSLITERATOR_0500
* @tc.name test transform with Any-Thai param
* @tc.desc get the transform value
*/
it('transliterator_test_0500', 0, function () {
console.log('transliterator_test_0500 ' + 'start');
let trans = I18n.Transliterator.getInstance('Any-Thai');
let value = trans.transform('中国');
console.log('transliterator_test_0500 ' + value);
expect(value).assertEqual('中国');
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_TRANSLITERATOR_0600
* @tc.name test transform with Any-zh param
* @tc.desc get the transform value
*/
it('transliterator_test_0600', 0, function () {
console.log('transliterator_test_0600 ' + 'start');
let trans = I18n.Transliterator.getInstance('Any-zh');
let value = trans.transform('nihao');
console.log('transliterator_test_0600 ' + value);
expect(value).assertEqual('nihao');
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_TRANSLITERATOR_0700
* @tc.name test transform with Any-Hant param
* @tc.desc get the transform value
*/
it('transliterator_test_0700', 0, function () {
console.log('transliterator_test_0700 ' + 'start');
let trans = I18n.Transliterator.getInstance('Any-Hant');
let value = trans.transform('hello');
console.log('transliterator_test_0700 ' + value);
expect(value).assertEqual('hello');
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_TRANSLITERATOR_0800
* @tc.name test transform with Any-Kannada param
* @tc.desc get the transform value
*/
it('transliterator_test_0800', 0, function () {
console.log('transliterator_test_0800 ' + 'start');
let trans = I18n.Transliterator.getInstance('Any-Kannada');
let value = trans.transform('hello');
console.log('transliterator_test_0800 ' + value);
expect(value).assertEqual('ಹೆಲ್ಲೊ');
})
console.log('*************end LangTest*************');
})}
......@@ -15,23 +15,35 @@
import BreakIteratorInI18nTest from './BreakIteratorInI18n.test.js'
import CalendarInI18nTest from './CalendarInI18n.test.js'
import CharacterInI18nTest from './CharacterInI18n.test.js'
import I18nTest from './I18n.test.js'
import I18nUtilInI18nTest from './I18nUtilInI18n.test.js'
import IndexUtilInI18nTest from './IndexUtilInI18n.test.js'
import intlTest from './Intl.test.js'
import NormalizerInI18nTest from './NormalizerInI18n.test.js'
import PhoneNumberFormatInI18nTest from './PhoneNumberFormatInI18n.test.js'
import LangTest from './Lang.test.js'
import SystemInI18nTest from './SystemInI18n.test.js'
import TimezoneInI18nTest from './TimezoneInI18n.test.js'
import TransliteratorInI18nTest from './TransliteratorInI18n.test.js'
import UnicodeInI18nTest from './UnicodeInI18n.test.js'
import UtilInI18nTest from './UtilInI18n.test.js'
import LocaleInIntlTest from './LocaleInIntl.test.js'
export default function testsuite() {
BreakIteratorInI18nTest()
CalendarInI18nTest()
CharacterInI18nTest()
I18nTest()
I18nUtilInI18nTest()
IndexUtilInI18nTest()
intlTest()
NormalizerInI18nTest()
PhoneNumberFormatInI18nTest()
LangTest()
SystemInI18nTest()
TimezoneInI18nTest()
TransliteratorInI18nTest()
UnicodeInI18nTest()
UtilInI18nTest()
LocaleInIntlTest()
}
/*
* Copyright (C) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import I18n from '@ohos.i18n'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
export default function NormalizerInI18nTest() {
describe('NormalizerInI18nTest', function () {
console.log('*************start NormalizerInI18nTest*************');
let hour = I18n.System.is24HourClock();
console.log('init 24 hour clock value ' + hour);
/* *
* execute this step before all testcases
*/
beforeAll(function(){
console.log('step before all cases in I18n.'
+ ' 24hour: ' + I18n.System.is24HourClock()
+ ' prelang: ' + I18n.System.getPreferredLanguageList()
+ ' syslocale: ' + I18n.System.getSystemLocale());
})
/* *
* execute this step before every testcase
*/
beforeEach(function(){
console.log('step before every case in I18n.');
})
/* *
* execute this step after every testcase
*/
afterEach(function(){
console.log('step after every case in I18n.');
})
/* *
* execute this step after all testcases
*/
afterAll(function(){
console.log('step after all cases in I18n.'
+ ' 24hour: ' + I18n.System.is24HourClock()
+ ' prelang: ' + I18n.System.getPreferredLanguageList()
+ ' syslocale: ' + I18n.System.getSystemLocale());
})
/**
* @tc.number SUB_GLOBAL_I18N_NORMALIZE_JS_0100
* @tc.name normalize the '1e9b 0323' in NFC mode
* @tc.desc get the NFC mode value
*/
it('i18n_normalizer_test_0100', 0, function () {
console.log('i18n_normalizer_test_0100 ' + 'start');
let str = '\u1e9b\u0323';
let normal = I18n.Normalizer.getInstance(I18n.NormalizerMode.NFC);
let value = normal.normalize(str);
console.log('i18n_normalizer_test_0100 ' + value);
expect(value).assertEqual('\u1e9b\u0323');
})
/**
* @tc.number SUB_GLOBAL_I18N_NORMALIZE_JS_0200
* @tc.name normalize the '1e9b 0323' in NFD mode
* @tc.desc get the NFD mode value
*/
it('i18n_normalizer_test_0200', 0, function () {
console.log('i18n_normalizer_test_0200 ' + 'start');
let str = '\u1e9b\u0323';
let normal = I18n.Normalizer.getInstance(I18n.NormalizerMode.NFD);
let value = normal.normalize(str);
console.log('i18n_normalizer_test_0200 ' + value);
expect(value).assertEqual('\u017f\u0323\u0307');
})
/**
* @tc.number SUB_GLOBAL_I18N_NORMALIZE_JS_0300
* @tc.name normalize the '1e9b 0323' in NFKC mode
* @tc.desc get the NFKC mode value
*/
it('i18n_normalizer_test_0300', 0, function () {
console.log('i18n_normalizer_test_0300 ' + 'start');
let str = '\u1e9b\u0323';
let normal = I18n.Normalizer.getInstance(I18n.NormalizerMode.NFKC);
let value = normal.normalize(str);
console.log('i18n_normalizer_test_0300 ' + value);
expect(value).assertEqual('\u1e69');
})
/**
* @tc.number SUB_GLOBAL_I18N_NORMALIZE_JS_0400
* @tc.name normalize the '1e9b 0323' in NFKD mode
* @tc.desc get the NFKD mode value
*/
it('i18n_normalizer_test_0400', 0, function () {
console.log('i18n_normalizer_test_0400 ' + 'start');
let str = '\u1e9b\u0323';
let normal = I18n.Normalizer.getInstance(I18n.NormalizerMode.NFKD);
let value = normal.normalize(str);
console.log('i18n_normalizer_test_0400 ' + value);
expect(value).assertEqual('\u0073\u0323\u0307');
})
/**
* @tc.number SUB_GLOBAL_I18N_NORMALIZE_JS_0500
* @tc.name normalize the '0032 2075' in NFC mode
* @tc.desc get the NFC mode value
*/
it('i18n_normalizer_test_0500', 0, function () {
console.log('i18n_normalizer_test_0500 ' + 'start');
let str = '\u0032\u2075';
let normal = I18n.Normalizer.getInstance(I18n.NormalizerMode.NFC);
let value = normal.normalize(str);
console.log('i18n_normalizer_test_0500 ' + value);
expect(value).assertEqual('\u0032\u2075');
})
/**
* @tc.number SUB_GLOBAL_I18N_NORMALIZE_JS_0600
* @tc.name normalize the '0032 2075' in NFD mode
* @tc.desc get the NFD mode value
*/
it('i18n_normalizer_test_0600', 0, function () {
console.log('i18n_normalizer_test_0600 ' + 'start');
let str = '\u0032\u2075';
let normal = I18n.Normalizer.getInstance(I18n.NormalizerMode.NFD);
let value = normal.normalize(str);
console.log('i18n_normalizer_test_0600 ' + value);
expect(value).assertEqual('\u0032\u2075');
})
/**
* @tc.number SUB_GLOBAL_I18N_NORMALIZE_JS_0700
* @tc.name normalize the '0032 2075' in NFKC mode
* @tc.desc get the NFKC mode value
*/
it('i18n_normalizer_test_0700', 0, function () {
console.log('i18n_normalizer_test_0700 ' + 'start');
let str = '\u0032\u2075';
let normal = I18n.Normalizer.getInstance(I18n.NormalizerMode.NFKC);
let value = normal.normalize(str);
console.log('i18n_normalizer_test_0700 ' + value);
expect(value).assertEqual('\u0032\u0035');
})
/**
* @tc.number SUB_GLOBAL_I18N_NORMALIZE_JS_0800
* @tc.name normalize the '0032 2075' in NFKD mode
* @tc.desc get the NFKD mode value
*/
it('i18n_normalizer_test_0800', 0, function () {
console.log('i18n_normalizer_test_0800 ' + 'start');
let str = '\u0032\u2075';
let normal = I18n.Normalizer.getInstance(I18n.NormalizerMode.NFKD);
let value = normal.normalize(str);
console.log('i18n_normalizer_test_0800 ' + value);
expect(value).assertEqual('\u0032\u0035');
})
/**
* @tc.number SUB_GLOBAL_I18N_NORMALIZE_JS_0900
* @tc.name getInstance method return 401 error code
* @tc.desc test the getInstance error code
*/
it('i18n_normalizer_test_0900', 0, function () {
console.log('i18n_normalizer_test_0900 ' + 'start');
let str = '\u0032\u2075';
try{
let normal = I18n.Normalizer.getInstance(0);
}catch(error){
console.log('i18n_normalizer_test_0900 ' + error.code);
console.log('i18n_normalizer_test_0900 ' + error.message);
expect(error.code == 401).assertTrue();
}
})
/**
* @tc.number SUB_GLOBAL_I18N_NORMALIZE_JS_1000
* @tc.name normalize method return 401 error code
* @tc.desc test the normalize error code
*/
it('i18n_normalizer_test_1000', 0, function () {
console.log('i18n_normalizer_test_1000 ' + 'start');
let str = '\u0032\u2075';
let normal = I18n.Normalizer.getInstance(1);
try{
let value = normal.normalize(1234);
}catch(error){
console.log('i18n_normalizer_test_1000 ' + error.code);
console.log('i18n_normalizer_test_1000 ' + error.message);
expect(error.code == 401).assertTrue();
}
})
console.log('*************end NormalizerInI18nTest*************');
})}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册