1/* 2 * Copyright (C) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15import I18n from '@ohos.i18n' 16import intl from '@ohos.intl' 17import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' 18 19export default function I18nTest() { 20describe('I18nTest', function () { 21 console.log('*************start I18NTest*************'); 22 23 let hour = I18n.is24HourClock(); 24 console.log('init 24 hour clock value ' + hour); 25 26 /* * 27 * execute this step before all testcases 28 */ 29 beforeAll(function(){ 30 console.log('step before all cases in I18n.' 31 + ' 24hour: ' + I18n.is24HourClock() 32 + ' prelang: ' + I18n.getPreferredLanguageList() 33 + ' syslocale: ' + I18n.getSystemLocale()); 34 }) 35 36 /* * 37 * execute this step before every testcase 38 */ 39 beforeEach(function(){ 40 console.log('step before every case in I18n.'); 41 }) 42 43 /* * 44 * execute this step after every testcase 45 */ 46 afterEach(function(){ 47 console.log('step after every case in I18n.'); 48 }) 49 50 /* * 51 * execute this step after all testcases 52 */ 53 afterAll(function(){ 54 console.log('step after all cases in I18n.' 55 + ' 24hour: ' + I18n.is24HourClock() 56 + ' prelang: ' + I18n.getPreferredLanguageList() 57 + ' syslocale: ' + I18n.getSystemLocale()); 58 }) 59 60 /* * 61 * @tc.number SUB_GLOBAL_I18N_JS_0100 62 * @tc.name getSystemLanguage 63 * @tc.desc check the getSystemLanguage 64 */ 65 it('i18n_test_0100', 0, function () { 66 let lang = I18n.getSystemLanguage(); 67 console.log('i18n_test_0100 ' + lang); 68 expect(lang).assertInstanceOf('String'); 69 }) 70 71 /* * 72 * @tc.number SUB_GLOBAL_I18N_JS_0200 73 * @tc.name getSystemRegion 74 * @tc.desc check the getSystemRegion 75 */ 76 it('i18n_test_0200', 0, function () { 77 let region = I18n.getSystemRegion(); 78 console.log('i18n_test_0200 ' + region); 79 expect(region).assertInstanceOf('String'); 80 }) 81 82 /* * 83 * @tc.number SUB_GLOBAL_I18N_JS_0300 84 * @tc.name getSystemLocale 85 * @tc.desc check the getSystemLocale 86 */ 87 it('i18n_test_0300', 0, function () { 88 let locale = I18n.getSystemLocale(); 89 console.log('i18n_test_0300 ' + locale); 90 expect(locale).assertInstanceOf('String'); 91 }) 92 93 /* * 94 * @tc.number SUB_GLOBAL_I18N_JS_2110 95 * @tc.name getSystemLanguages test 96 * @tc.desc check the getSystemLanguages 97 */ 98 it('i18n_test_2110', 0, function () { 99 let value = I18n.System.getSystemLanguages(); 100 let len = value.length; 101 console.log('i18n_test_2110 ' + len); 102 expect(len).assertLarger(0); 103 }) 104 105 /* * 106 * @tc.number SUB_GLOBAL_I18N_JS_2120 107 * @tc.name getSystemCountries with en param 108 * @tc.desc check the getSystemCountries 109 */ 110 it('i18n_test_2120', 0, function () { 111 let value = I18n.System.getSystemCountries('en'); 112 let len = value.length; 113 console.log('i18n_test_2120 ' + len); 114 expect(len).assertLarger(0); 115 }) 116 117 /* * 118 * @tc.number SUB_GLOBAL_I18N_JS_2310 119 * @tc.name isSuggested with zh param 120 * @tc.desc check the isSuggested 121 */ 122 it('i18n_test_2310', 0, function () { 123 let value = I18n.isSuggested('zh'); 124 console.log('i18n_test_2310 ' + value); 125 expect(value).assertTrue(); 126 }) 127 128 /* * 129 * @tc.number SUB_GLOBAL_I18N_JS_2320 130 * @tc.name isSuggested with en param 131 * @tc.desc check the isSuggested 132 */ 133 it('i18n_test_2320', 0, function () { 134 let value = I18n.isSuggested('en'); 135 console.log('i18n_test_2320 ' + value); 136 expect(value).assertFalse(); 137 }) 138 139 /* * 140 * @tc.number SUB_GLOBAL_I18N_JS_2330 141 * @tc.name isSuggested with zh-CN param 142 * @tc.desc check the isSuggested 143 */ 144 it('i18n_test_2330', 0, function () { 145 let value = I18n.isSuggested('zh', 'CN'); 146 console.log('i18n_test_2330 ' + value); 147 expect(value).assertTrue(); 148 }) 149 150 /* * 151 * @tc.number SUB_GLOBAL_I18N_JS_2340 152 * @tc.name isSuggested with en-US param 153 * @tc.desc check the isSuggested 154 */ 155 it('i18n_test_2340', 0, function () { 156 let value = I18n.isSuggested('en' , 'US'); 157 console.log('i18n_test_2340 ' + value); 158 expect(value).assertTrue(); 159 }) 160 161 /* * 162 * @tc.number SUB_GLOBAL_I18N_JS_3800 163 * @tc.name getDisplayCountry with zh-Hans-CN and en-US and true param 164 * @tc.desc check the display country 165 */ 166 it('i18n_test_3800', 0, function () { 167 let value = I18n.getDisplayCountry('zh-Hans-CN', 'en-US', true); 168 console.log('i18n_test_3800 ' + value); 169 expect(value).assertEqual('China'); 170 }) 171 172 /* * 173 * @tc.number SUB_GLOBAL_I18N_JS_3900 174 * @tc.name getDisplayCountry with zh and en-US and true param 175 * @tc.desc check the display country 176 */ 177 it('i18n_test_3900', 0, function () { 178 let value = I18n.getDisplayCountry('zh', 'en-US', true); 179 console.log('i18n_test_3900 ' + value); 180 expect(value).assertEqual(''); 181 }) 182 183 /* * 184 * @tc.number SUB_GLOBAL_I18N_JS_4000 185 * @tc.name getDisplayCountry with zh-CN and en-US and true param 186 * @tc.desc check the display country 187 */ 188 it('i18n_test_4000', 0, function () { 189 let value = I18n.getDisplayCountry('zh-CN', 'en-US', true); 190 console.log('i18n_test_4000 ' + value); 191 expect(value).assertEqual('China'); 192 }) 193 194 /* * 195 * @tc.number SUB_GLOBAL_I18N_JS_4100 196 * @tc.name getDisplayCountry with zh-Hans and en-US and true param 197 * @tc.desc check the display country 198 */ 199 it('i18n_test_4100', 0, function () { 200 let value = I18n.getDisplayCountry('zh-Hans', 'en-US', true); 201 console.log('i18n_test_4100 ' + value); 202 expect(value).assertEqual(''); 203 }) 204 205 /* * 206 * @tc.number SUB_GLOBAL_I18N_JS_4200 207 * @tc.name getDisplayCountry with zh-Hans-CN and en-US and false param 208 * @tc.desc check the language 209 */ 210 it('i18n_test_4200', 0, function () { 211 let value = I18n.getDisplayCountry('zh-Hans-CN', 'en-US', false); 212 console.log('i18n_test_4200 ' + value); 213 expect(value).assertEqual('China'); 214 }) 215 216 /* * 217 * @tc.number SUB_GLOBAL_I18N_JS_4300 218 * @tc.name getDisplayCountry with zh-Hans-CN and en-US param 219 * @tc.desc check the language 220 */ 221 it('i18n_test_4300', 0, function () { 222 let value = I18n.getDisplayCountry('zh-Hans-CN', 'en-US'); 223 console.log('i18n_test_4300 ' + value); 224 expect(value).assertEqual('China'); 225 }) 226 227 /* * 228 * @tc.number SUB_GLOBAL_I18N_JS_4400 229 * @tc.name getDisplayLanguage with zh-Hans-CN and en-US and true param 230 * @tc.desc check the language 231 */ 232 it('i18n_test_4400', 0, function () { 233 let value = I18n.getDisplayLanguage('zh-Hans-CN', 'en-US', true); 234 console.log('i18n_test_4400 ' + value); 235 expect(value).assertEqual('Simplified Chinese'); 236 }) 237 238 /* * 239 * @tc.number SUB_GLOBAL_I18N_JS_4500 240 * @tc.name getDisplayLanguage with zh-Hans-CN and en-GB and true param 241 * @tc.desc check the language 242 */ 243 it('i18n_test_4500', 0, function () { 244 let value = I18n.getDisplayLanguage('zh-Hans-CN', 'en-GB', true); 245 console.log('i18n_test_4500 ' + value); 246 expect(value).assertEqual('Simplified Chinese'); 247 }) 248 249 /* * 250 * @tc.number SUB_GLOBAL_I18N_JS_4600 251 * @tc.name getDisplayLanguage with zh and en-US and true param 252 * @tc.desc check the language 253 */ 254 it('i18n_test_4600', 0, function () { 255 let value = I18n.getDisplayLanguage('zh', 'en-US', true); 256 console.log('i18n_test_4600 ' + value); 257 expect(value).assertEqual('Chinese'); 258 }) 259 260 /* * 261 * @tc.number SUB_GLOBAL_I18N_JS_4700 262 * @tc.name getDisplayLanguage with zh-CN and en-US and true param 263 * @tc.desc check the language 264 */ 265 it('i18n_test_4700', 0, function () { 266 let value = I18n.getDisplayLanguage('zh-CN', 'en-US', true); 267 console.log('i18n_test_4700 ' + value); 268 expect(value).assertEqual('Chinese'); 269 }) 270 271 /* * 272 * @tc.number SUB_GLOBAL_I18N_JS_4800 273 * @tc.name getDisplayLanguage with zh-Hans and en-US and true param 274 * @tc.desc check the language 275 */ 276 it('i18n_test_4800', 0, function () { 277 let value = I18n.getDisplayLanguage('zh-Hans', 'en-US', true); 278 console.log('i18n_test_4800 ' + value); 279 expect(value).assertEqual('Simplified Chinese'); 280 }) 281 282 /* * 283 * @tc.number SUB_GLOBAL_I18N_JS_4900 284 * @tc.name getDisplayLanguage with zh-Hans-CN and en-US and false param 285 * @tc.desc check the language 286 */ 287 it('i18n_test_4900', 0, function () { 288 let value = I18n.getDisplayLanguage('zh-Hans-CN', 'en-US', false); 289 console.log('i18n_test_4900 ' + value); 290 expect(value).assertEqual('Simplified Chinese'); 291 }) 292 293 /* * 294 * @tc.number SUB_GLOBAL_I18N_JS_5000 295 * @tc.name getDisplayLanguage with zh-Hans-CN and en-US param 296 * @tc.desc check the language 297 */ 298 it('i18n_test_5000', 0, function () { 299 let value = I18n.getDisplayLanguage('zh-Hans-CN', 'en-US'); 300 console.log('i18n_test_5000 ' + value); 301 expect(value).assertEqual('Simplified Chinese'); 302 }) 303 304 /** 305 * @tc.number SUB_GLOBAL_I18N_JS_5100 306 * @tc.name test isValidNumber interface with 13510574676 param 307 * @tc.desc get the isValidNumber value 308 */ 309 it('i18n_test_5100', 0, function () { 310 console.log('i18n_test_5100 ' + 'start'); 311 let phonenumber = new I18n.PhoneNumberFormat('CN'); 312 let ran = Math.ceil(Math.random(1) * 9); 313 console.log('i18n_test_5100 ' + ran); 314 let valid = phonenumber.isValidNumber('1351057467' + ran); 315 console.log('i18n_test_5100 ' + valid); 316 expect(valid).assertEqual(true); 317 }) 318 319 /** 320 * @tc.number SUB_GLOBAL_I18N_JS_5120 321 * @tc.name test isValidNumber interface with 0755-6100088X param 322 * @tc.desc get the isValidNumber value 323 */ 324 it('i18n_test_5120', 0, function () { 325 console.log('i18n_test_5120 ' + 'start'); 326 let phonenumber = new I18n.PhoneNumberFormat('CN'); 327 let ran = Math.ceil(Math.random(1) * 9); 328 console.log('i18n_test_5120 ' + ran); 329 let valid = phonenumber.isValidNumber('0755-6100088' + ran); 330 console.log('i18n_test_5120 ' + valid); 331 expect(valid).assertEqual(true); 332 }) 333 334 /** 335 * @tc.number SUB_GLOBAL_I18N_JS_5140 336 * @tc.name test isValidNumber interface with 110 param 337 * @tc.desc get the isValidNumber value 338 */ 339 it('i18n_test_5140', 0, function () { 340 console.log('i18n_test_5140 ' + 'start'); 341 let phonenumber = new I18n.PhoneNumberFormat('CN'); 342 let valid = phonenumber.isValidNumber('110'); 343 console.log('i18n_test_5140 ' + valid); 344 expect(valid).assertEqual(false); 345 }) 346 347 /** 348 * @tc.number SUB_GLOBAL_I18N_JS_5200 349 * @tc.name test isValidNumber interface with 135 1057 4676 param 350 * @tc.desc get the isValidNumber value 351 */ 352 it('i18n_test_5200', 0, function () { 353 console.log('i18n_test_5200 ' + 'start'); 354 let phonenumber = new I18n.PhoneNumberFormat('CN'); 355 let ran = Math.ceil(Math.random(1) * 9); 356 console.log('i18n_test_5200 ' + ran); 357 let valid = phonenumber.isValidNumber('135 1057 467' + ran); 358 console.log('i18n_test_5200 ' + valid); 359 expect(valid).assertEqual(true); 360 }) 361 362 /** 363 * @tc.number SUB_GLOBAL_I18N_JS_5300 364 * @tc.name test isValidNumber interface with +86 135 1057 4676 param 365 * @tc.desc get the isValidNumber value 366 */ 367 it('i18n_test_5300', 0, function () { 368 console.log('i18n_test_5300 ' + 'start'); 369 let phonenumber = new I18n.PhoneNumberFormat('CN'); 370 let ran = Math.ceil(Math.random(1) * 9); 371 console.log('i18n_test_5300 ' + ran); 372 let valid = phonenumber.isValidNumber('+86 135 1057 467' + ran); 373 console.log('i18n_test_5300 ' + valid); 374 expect(valid).assertEqual(true); 375 }) 376 377 /** 378 * @tc.number SUB_GLOBAL_I18N_JS_5400 379 * @tc.name test isValidNumber interface with 135-1057-4676 param 380 * @tc.desc get the isValidNumber value 381 */ 382 it('i18n_test_5400', 0, function () { 383 console.log('i18n_test_5400 ' + 'start'); 384 let phonenumber = new I18n.PhoneNumberFormat('CN'); 385 let ran = Math.ceil(Math.random(1) * 9); 386 console.log('i18n_test_5400 ' + ran); 387 let valid = phonenumber.isValidNumber('135-1057-467' + ran); 388 console.log('i18n_test_5400 ' + valid); 389 expect(valid).assertEqual(true); 390 }) 391 392 /** 393 * @tc.number SUB_GLOBAL_I18N_JS_5500 394 * @tc.name test isValidNumber interface with tel:+86-135-1057-4676 param 395 * @tc.desc get the isValidNumber value 396 */ 397 it('i18n_test_5500', 0, function () { 398 console.log('i18n_test_5500 ' + 'start'); 399 let phonenumber = new I18n.PhoneNumberFormat('CN'); 400 let ran = Math.ceil(Math.random(1) * 9); 401 console.log('i18n_test_5500 ' + ran); 402 let valid = phonenumber.isValidNumber('tel:+86-135-1057-467' + ran); 403 console.log('i18n_test_5500 ' + valid); 404 expect(valid).assertEqual(true); 405 }) 406 407 /** 408 * @tc.number SUB_GLOBAL_I18N_JS_5600 409 * @tc.name test isValidNumber interface with 86-135-1057-4676 param 410 * @tc.desc get the isValidNumber value 411 */ 412 it('i18n_test_5600', 0, function () { 413 console.log('i18n_test_5600 ' + 'start'); 414 let phonenumber = new I18n.PhoneNumberFormat('CN'); 415 let ran = Math.ceil(Math.random(1) * 9); 416 console.log('i18n_test_5600 ' + ran); 417 let valid = phonenumber.isValidNumber('86-135-1057-467' + ran); 418 console.log('i18n_test_5600 ' + valid); 419 expect(valid).assertEqual(true); 420 }) 421 422 /** 423 * @tc.number SUB_GLOBAL_I18N_JS_5700 424 * @tc.name test isValidNumber interface with +8613510574676 param 425 * @tc.desc get the isValidNumber value 426 */ 427 it('i18n_test_5700', 0, function () { 428 console.log('i18n_test_5700 ' + 'start'); 429 let phonenumber = new I18n.PhoneNumberFormat('CN'); 430 let ran = Math.ceil(Math.random(1) * 9); 431 console.log('i18n_test_5700 ' + ran); 432 let valid = phonenumber.isValidNumber('+861351057467' + ran); 433 console.log('i18n_test_5700 ' + valid); 434 expect(valid).assertEqual(true); 435 }) 436 437 /** 438 * @tc.number SUB_GLOBAL_I18N_JS_5800 439 * @tc.name test isValidNumber interface with 8613510574676 param 440 * @tc.desc get the isValidNumber value 441 */ 442 it('i18n_test_5800', 0, function () { 443 console.log('i18n_test_5800 ' + 'start'); 444 let phonenumber = new I18n.PhoneNumberFormat('CN'); 445 let ran = Math.ceil(Math.random(1) * 9); 446 console.log('i18n_test_5800 ' + ran); 447 let valid = phonenumber.isValidNumber('861351057467' + ran); 448 console.log('i18n_test_5800 ' + valid); 449 expect(valid).assertEqual(true); 450 }) 451 452 /** 453 * @tc.number SUB_GLOBAL_I18N_JS_5900 454 * @tc.name test isValidNumber interface with 1351057467 param 455 * @tc.desc get the isValidNumber value 456 */ 457 it('i18n_test_5900', 0, function () { 458 console.log('i18n_test_5900 ' + 'start'); 459 let phonenumber = new I18n.PhoneNumberFormat('CN'); 460 let ran = Math.ceil(Math.random(1) * 9); 461 console.log('i18n_test_5900 ' + ran); 462 let valid = phonenumber.isValidNumber('135105746' + ran); 463 console.log('i18n_test_5900 ' + valid); 464 expect(valid).assertEqual(false); 465 }) 466 467 /** 468 * @tc.number SUB_GLOBAL_I18N_JS_6000 469 * @tc.name test isValidNumber interface with 135105746761 param 470 * @tc.desc get the isValidNumber value 471 */ 472 it('i18n_test_6000', 0, function () { 473 console.log('i18n_test_6000 ' + 'start'); 474 let phonenumber = new I18n.PhoneNumberFormat('CN'); 475 let ran = Math.ceil(Math.random(1) * 9); 476 console.log('i18n_test_6000 ' + ran); 477 let valid = phonenumber.isValidNumber('13510574676' + ran); 478 console.log('i18n_test_6000 ' + valid); 479 expect(valid).assertEqual(false); 480 }) 481 482 /** 483 * @tc.number SUB_GLOBAL_I18N_JS_6100 484 * @tc.name test isValidNumber interface with 1351057467a param 485 * @tc.desc get the isValidNumber value 486 */ 487 it('i18n_test_6100', 0, function () { 488 console.log('i18n_test_6100 ' + 'start'); 489 let phonenumber = new I18n.PhoneNumberFormat('CN'); 490 let ran = Math.ceil(Math.random(1) * 9); 491 console.log('i18n_test_6100 ' + ran); 492 let valid = phonenumber.isValidNumber('135105746' + ran + 'a'); 493 console.log('i18n_test_6100 ' + valid); 494 expect(valid).assertEqual(false); 495 }) 496 497 /** 498 * @tc.number SUB_GLOBAL_I18N_JS_6200 499 * @tc.name test isValidNumber interface with 6262023379 param 500 * @tc.desc get the isValidNumber value 501 */ 502 it('i18n_test_6200', 0, function () { 503 console.log('i18n_test_6200 ' + 'start'); 504 let phonenumber = new I18n.PhoneNumberFormat('US'); 505 let ran = Math.ceil(Math.random(1) * 9); 506 console.log('i18n_test_6200 ' + ran); 507 let valid = phonenumber.isValidNumber('626202337' + ran); 508 console.log('i18n_test_6200 ' + valid); 509 expect(valid).assertEqual(true); 510 }) 511 512 /** 513 * @tc.number SUB_GLOBAL_I18N_JS_6300 514 * @tc.name test isValidNumber interface with 626202337 param 515 * @tc.desc get the isValidNumber value 516 */ 517 it('i18n_test_6300', 0, function () { 518 console.log('i18n_test_6300 ' + 'start'); 519 let phonenumber = new I18n.PhoneNumberFormat('US'); 520 let ran = Math.ceil(Math.random(1) * 9); 521 console.log('i18n_test_6300 ' + ran); 522 let valid = phonenumber.isValidNumber('62620233' + ran); 523 console.log('i18n_test_6300 ' + valid); 524 expect(valid).assertEqual(false); 525 }) 526 527 /** 528 * @tc.number SUB_GLOBAL_I18N_JS_6400 529 * @tc.name test isValidNumber interface with 62620233791 param 530 * @tc.desc get the isValidNumber value 531 */ 532 it('i18n_test_6400', 0, function () { 533 console.log('i18n_test_6400 ' + 'start'); 534 let phonenumber = new I18n.PhoneNumberFormat('US'); 535 let ran = Math.ceil(Math.random(1) * 9); 536 console.log('i18n_test_6400 ' + ran); 537 let valid = phonenumber.isValidNumber('6262023379' + ran); 538 console.log('i18n_test_6400 ' + valid); 539 expect(valid).assertEqual(false); 540 }) 541 542 /** 543 * @tc.number SUB_GLOBAL_I18N_JS_6500 544 * @tc.name test isValidNumber interface with 626202337a param 545 * @tc.desc get the isValidNumber value 546 */ 547 it('i18n_test_6500', 0, function () { 548 console.log('i18n_test_6500 ' + 'start'); 549 let phonenumber = new I18n.PhoneNumberFormat('US'); 550 let ran = Math.ceil(Math.random(1) * 9); 551 console.log('i18n_test_6500 ' + ran); 552 let valid = phonenumber.isValidNumber('62620233' + ran + 'a'); 553 console.log('i18n_test_6500 ' + valid); 554 expect(valid).assertEqual(false); 555 }) 556 557 /** 558 * @tc.number SUB_GLOBAL_I18N_JS_6600 559 * @tc.name test format interface with 13510574676 param 560 * @tc.desc get the isValidNumber value 561 */ 562 it('i18n_test_6600', 0, function () { 563 console.log('i18n_test_6600 ' + 'start'); 564 let phonenumber = new I18n.PhoneNumberFormat('CN'); 565 let ran = Math.ceil(Math.random(1) * 9); 566 console.log('i18n_test_6600 ' + ran); 567 let value = phonenumber.format('1351057467' + ran); 568 console.log('i18n_test_6600 ' + value); 569 expect(value).assertEqual('135 1057 467' + ran); 570 }) 571 572 /** 573 * @tc.number SUB_GLOBAL_I18N_JS_6700 574 * @tc.name test format interface with 6262023379 param 575 * @tc.desc get the isValidNumber value 576 */ 577 it('i18n_test_6700', 0, function () { 578 console.log('i18n_test_6700 ' + 'start'); 579 let phonenumber = new I18n.PhoneNumberFormat('US'); 580 let ran = Math.ceil(Math.random(1) * 9); 581 console.log('i18n_test_6700 ' + ran); 582 let value = phonenumber.format('626202337' + ran); 583 console.log('i18n_test_6700 ' + value); 584 expect(value).assertEqual('(626) 202-337' + ran); 585 }) 586 587 /** 588 * @tc.number SUB_GLOBAL_I18N_JS_6800 589 * @tc.name test format interface with 13510574676 and NATIONAL type param 590 * @tc.desc get the isValidNumber value 591 */ 592 it('i18n_test_6800', 0, function () { 593 console.log('i18n_test_6800 ' + 'start'); 594 let phonenumber = new I18n.PhoneNumberFormat('CN', {'type': 'NATIONAL'}); 595 let ran = Math.ceil(Math.random(1) * 9); 596 console.log('i18n_test_6800 ' + ran); 597 let value = phonenumber.format('1351057467' + ran); 598 console.log('i18n_test_6800 ' + value); 599 expect(value).assertEqual('135 1057 467' + ran); 600 }) 601 602 /** 603 * @tc.number SUB_GLOBAL_I18N_JS_6900 604 * @tc.name test format interface with 1351057467 and NATIONAL type param 605 * @tc.desc get the isValidNumber value 606 */ 607 it('i18n_test_6900', 0, function () { 608 console.log('i18n_test_6900 ' + 'start'); 609 let phonenumber = new I18n.PhoneNumberFormat('CN', {'type': 'NATIONAL'}); 610 let ran = Math.ceil(Math.random(1) * 9); 611 console.log('i18n_test_6900 ' + ran); 612 let value = phonenumber.format('135105746' + ran); 613 console.log('i18n_test_6900 ' + value); 614 expect(value).assertEqual('135105746' + ran); 615 }) 616 617 /** 618 * @tc.number SUB_GLOBAL_I18N_JS_7000 619 * @tc.name test format interface with 135105746761 and NATIONAL type param 620 * @tc.desc get the isValidNumber value 621 */ 622 it('i18n_test_7000', 0, function () { 623 console.log('i18n_test_7000 ' + 'start'); 624 let phonenumber = new I18n.PhoneNumberFormat('CN', {'type': 'NATIONAL'}); 625 let ran = Math.ceil(Math.random(1) * 9); 626 console.log('i18n_test_7000 ' + ran); 627 let value = phonenumber.format('13510574676' + ran); 628 console.log('i18n_test_7000 ' + value); 629 expect(value).assertEqual('013 510 574 676' + ran); 630 }) 631 632 /** 633 * @tc.number SUB_GLOBAL_I18N_JS_7100 634 * @tc.name test format interface with 135 1057 4676 and NATIONAL type param 635 * @tc.desc get the isValidNumber value 636 */ 637 it('i18n_test_7100', 0, function () { 638 console.log('i18n_test_7100 ' + 'start'); 639 let phonenumber = new I18n.PhoneNumberFormat('CN', {'type': 'NATIONAL'}); 640 let ran = Math.ceil(Math.random(1) * 9); 641 console.log('i18n_test_7100 ' + ran); 642 let value = phonenumber.format('135 1057 467' + ran); 643 console.log('i18n_test_7100 ' + value); 644 expect(value).assertEqual('135 1057 467' + ran); 645 }) 646 647 /** 648 * @tc.number SUB_GLOBAL_I18N_JS_7200 649 * @tc.name test format interface with 13510574676 and INTERNATIONAL type param 650 * @tc.desc get the isValidNumber value 651 */ 652 it('i18n_test_7200', 0, function () { 653 console.log('i18n_test_7200 ' + 'start'); 654 let phonenumber = new I18n.PhoneNumberFormat('CN', {'type': 'INTERNATIONAL'}); 655 let ran = Math.ceil(Math.random(1) * 9); 656 console.log('i18n_test_7200 ' + ran); 657 let value = phonenumber.format('1351057467' + ran); 658 console.log('i18n_test_7200 ' + value); 659 expect(value).assertEqual('+86 135 1057 467' + ran); 660 }) 661 662 /** 663 * @tc.number SUB_GLOBAL_I18N_JS_7300 664 * @tc.name test format interface with 13510574676 and RFC3966 type param 665 * @tc.desc get the isValidNumber value 666 */ 667 it('i18n_test_7300', 0, function () { 668 console.log('i18n_test_7300 ' + 'start'); 669 let phonenumber = new I18n.PhoneNumberFormat('CN', {'type': 'RFC3966'}); 670 let ran = Math.ceil(Math.random(1) * 9); 671 console.log('i18n_test_7300 ' + ran); 672 let value = phonenumber.format('1351057467' + ran); 673 console.log('i18n_test_7300 ' + value); 674 expect(value).assertEqual('tel:+86-135-1057-467' + ran); 675 }) 676 677 /** 678 * @tc.number SUB_GLOBAL_I18N_JS_7400 679 * @tc.name test format interface with 13510574676 and E164 type param 680 * @tc.desc get the isValidNumber value 681 */ 682 it('i18n_test_7400', 0, function () { 683 console.log('i18n_test_7400 ' + 'start'); 684 let phonenumber = new I18n.PhoneNumberFormat('CN', {'type': 'E164'}); 685 let ran = Math.ceil(Math.random(1) * 9); 686 console.log('i18n_test_7400 ' + ran); 687 let value = phonenumber.format('1351057467' + ran); 688 console.log('i18n_test_7400 ' + value); 689 expect(value).assertEqual('+861351057467' + ran); 690 }) 691 692 /** 693 * @tc.number SUB_GLOBAL_I18N_JS_7500 694 * @tc.name test format interface with 6262023379 and NATIONAL type param 695 * @tc.desc get the isValidNumber value 696 */ 697 it('i18n_test_7500', 0, function () { 698 console.log('i18n_test_7500 ' + 'start'); 699 let phonenumber = new I18n.PhoneNumberFormat('US', {'type': 'NATIONAL'}); 700 let ran = Math.ceil(Math.random(1) * 9); 701 console.log('i18n_test_7500 ' + ran); 702 let value = phonenumber.format('626202337' + ran); 703 console.log('i18n_test_7500 ' + value); 704 expect(value).assertEqual('(626) 202-337' + ran); 705 }) 706 707 /** 708 * @tc.number SUB_GLOBAL_I18N_JS_7600 709 * @tc.name test format interface with 6262023379 and INTERNATIONAL type param 710 * @tc.desc get the isValidNumber value 711 */ 712 it('i18n_test_7600', 0, function () { 713 console.log('i18n_test_7600 ' + 'start'); 714 let phonenumber = new I18n.PhoneNumberFormat('US', {'type': 'INTERNATIONAL'}); 715 let ran = Math.ceil(Math.random(1) * 9); 716 console.log('i18n_test_7600 ' + ran); 717 let value = phonenumber.format('626202337' + ran); 718 console.log('i18n_test_7600 ' + value); 719 expect(value).assertEqual('+1 626-202-337' + ran); 720 }) 721 722 /** 723 * @tc.number SUB_GLOBAL_I18N_JS_7700 724 * @tc.name test format interface with 6262023379 and RFC3966 type param 725 * @tc.desc get the isValidNumber value 726 */ 727 it('i18n_test_7700', 0, function () { 728 console.log('i18n_test_7700 ' + 'start'); 729 let phonenumber = new I18n.PhoneNumberFormat('US', {'type': 'RFC3966'}); 730 let ran = Math.ceil(Math.random(1) * 9); 731 console.log('i18n_test_7700 ' + ran); 732 let value = phonenumber.format('626202337' + ran); 733 console.log('i18n_test_7700 ' + value); 734 expect(value).assertEqual('tel:+1-626-202-337' + ran); 735 }) 736 737 /** 738 * @tc.number SUB_GLOBAL_I18N_JS_7800 739 * @tc.name test format interface with 6262023379 and E164 type param 740 * @tc.desc get the isValidNumber value 741 */ 742 it('i18n_test_7800', 0, function () { 743 console.log('i18n_test_7800 ' + 'start'); 744 let phonenumber = new I18n.PhoneNumberFormat('US', {'type': 'E164'}); 745 let ran = Math.ceil(Math.random(1) * 9); 746 console.log('i18n_test_7800 ' + ran); 747 let value = phonenumber.format('626202337' + ran); 748 console.log('i18n_test_7800 ' + value); 749 expect(value).assertEqual('+1626202337' + ran); 750 }) 751 752 /** 753 * @tc.number SUB_GLOBAL_I18N_JS_7810 754 * @tc.name test getLocationName method with 135... num in zh-CN locale 755 * @tc.desc get the getLocationName value 756 */ 757 it('i18n_test_7810', 0, function () { 758 console.log('i18n_test_7810 ' + 'start'); 759 let phonenumber = new I18n.PhoneNumberFormat('CN'); 760 let ran = Math.ceil(Math.random(1) * 9); 761 console.log('i18n_test_7810 ' + ran); 762 let value = phonenumber.getLocationName('1351057467' + ran, 'zh-CN'); 763 console.log('i18n_test_7810 ' + value); 764 expect(value == '中国' || value == '广东省深圳市').assertTrue(); 765 }) 766 767 /** 768 * @tc.number SUB_GLOBAL_I18N_JS_7820 769 * @tc.name test getLocationName method with 135... num in en-US locale 770 * @tc.desc get the getLocationName value 771 */ 772 it('i18n_test_7820', 0, function () { 773 console.log('i18n_test_7820 ' + 'start'); 774 let phonenumber = new I18n.PhoneNumberFormat('CN'); 775 let ran = Math.ceil(Math.random(1) * 9); 776 console.log('i18n_test_7820 ' + ran); 777 let value = phonenumber.getLocationName('+861351057467' + ran, 'en-US'); 778 console.log('i18n_test_7820 ' + value); 779 expect(value == 'China' || value == 'Shenzhen, Guangdong').assertTrue(); 780 let value2 = phonenumber.getLocationName('+86 1351057467' + ran, 'en-US'); 781 console.log('i18n_test_7820 ' + value2); 782 expect(value2 == 'China' || value2 == 'Shenzhen, Guangdong').assertTrue(); 783 }) 784 785 /** 786 * @tc.number SUB_GLOBAL_I18N_JS_7830 787 * @tc.name test getLocationName method with 158... num in en-US locale 788 * @tc.desc get the getLocationName value 789 */ 790 it('i18n_test_7830', 0, function () { 791 console.log('i18n_test_7830 ' + 'start'); 792 let phonenumber = new I18n.PhoneNumberFormat('CN'); 793 let ran = Math.ceil(Math.random(1) * 9); 794 console.log('i18n_test_7830 ' + ran); 795 let value1 = phonenumber.getLocationName('+861586661737' + ran, 'en-US'); 796 console.log('i18n_test_7830 ' + value1); 797 expect(value1 == 'China' || value1 == 'Jinan, Shandong').assertTrue(); 798 let value2 = phonenumber.getLocationName('+86 1586661737' + ran, 'en-US'); 799 console.log('i18n_test_7830 ' + value2); 800 expect(value2 == 'China' || value2 == 'Jinan, Shandong').assertTrue(); 801 }) 802 803 /** 804 * @tc.number SUB_GLOBAL_I18N_JS_7840 805 * @tc.name test getLocationName method with 027... num in zh-CN locale 806 * @tc.desc get the getLocationName value 807 */ 808 it('i18n_test_7840', 0, function () { 809 console.log('i18n_test_7840 ' + 'start'); 810 let phonenumber = new I18n.PhoneNumberFormat('CN'); 811 let ran = Math.ceil(Math.random(1) * 9); 812 console.log('i18n_test_7840 ' + ran); 813 let value = phonenumber.getLocationName('027-5937411' + ran, 'zh-CN'); 814 console.log('i18n_test_7840 ' + value); 815 expect(value == '中国' || value == '湖北省武汉市').assertTrue(); 816 }) 817 818 /** 819 * @tc.number SUB_GLOBAL_I18N_JS_7850 820 * @tc.name test getLocationName method with 0728... num in zh-CN locale 821 * @tc.desc get the getLocationName value 822 */ 823 it('i18n_test_7850', 0, function () { 824 console.log('i18n_test_7850 ' + 'start'); 825 let phonenumber = new I18n.PhoneNumberFormat('CN'); 826 let ran = Math.ceil(Math.random(1) * 9); 827 console.log('i18n_test_7850 ' + ran); 828 let value = phonenumber.getLocationName('0728-623797' + ran, 'zh-CN'); 829 console.log('i18n_test_7850 ' + value); 830 expect(value == '中国' || value == '湖北省仙桃市').assertTrue(); 831 }) 832 833 /** 834 * @tc.number SUB_GLOBAL_I18N_JS_7860 835 * @tc.name test getLocationName method with +34... num in en-US locale 836 * @tc.desc get the getLocationName value 837 */ 838 it('i18n_test_7860', 0, function () { 839 console.log('i18n_test_7860 ' + 'start'); 840 let phonenumber = new I18n.PhoneNumberFormat('CN'); 841 let ran = Math.ceil(Math.random(1) * 9); 842 console.log('i18n_test_7860 ' + ran); 843 let value1 = phonenumber.getLocationName('+3460724205' + ran, 'en-US'); 844 console.log('i18n_test_7860 ' + value1); 845 expect(value1).assertEqual('Spain'); 846 let value2 = phonenumber.getLocationName('+34 60724205' + ran, 'en-US'); 847 console.log('i18n_test_7860 ' + value2); 848 expect(value2).assertEqual('Spain'); 849 }) 850 851 /** 852 * @tc.number SUB_GLOBAL_I18N_JS_7870 853 * @tc.name test getLocationName method with +39... num in en-US locale 854 * @tc.desc get the getLocationName value 855 */ 856 it('i18n_test_7870', 0, function () { 857 console.log('i18n_test_7870 ' + 'start'); 858 let phonenumber = new I18n.PhoneNumberFormat('CN'); 859 let ran = Math.ceil(Math.random(1) * 9); 860 console.log('i18n_test_7870 ' + ran); 861 let value = phonenumber.getLocationName('+39342652441' + ran, 'en-US'); 862 console.log('i18n_test_7870 ' + value); 863 expect(value).assertEqual('Italy'); 864 let value2 = phonenumber.getLocationName('+39 342652441' + ran, 'en-US'); 865 console.log('i18n_test_7870 ' + value2); 866 expect(value2).assertEqual('Italy'); 867 }) 868 869 /** 870 * @tc.number SUB_GLOBAL_I18N_JS_7880 871 * @tc.name test getLocationName method with +39... num in zh-CN locale 872 * @tc.desc get the getLocationName value 873 */ 874 it('i18n_test_7880', 0, function () { 875 console.log('i18n_test_7880 ' + 'start'); 876 let phonenumber = new I18n.PhoneNumberFormat('CN'); 877 let ran = Math.ceil(Math.random(1) * 9); 878 console.log('i18n_test_7880 ' + ran); 879 let value = phonenumber.getLocationName('+39342652441' + ran, 'zh-CN'); 880 console.log('i18n_test_7880 ' + value); 881 expect(value).assertEqual('意大利'); 882 let value2 = phonenumber.getLocationName('+39 342652441' + ran, 'zh-CN'); 883 console.log('i18n_test_7880 ' + value2); 884 expect(value2).assertEqual('意大利'); 885 }) 886 887 /** 888 * @tc.number SUB_GLOBAL_I18N_JS_7890 889 * @tc.name test getLocationName method with +34... num in zh-CN locale 890 * @tc.desc get the getLocationName value 891 */ 892 it('i18n_test_7890', 0, function () { 893 console.log('i18n_test_7890 ' + 'start'); 894 let phonenumber = new I18n.PhoneNumberFormat('CN'); 895 let ran = Math.ceil(Math.random(1) * 9); 896 console.log('i18n_test_7890 ' + ran); 897 let value1 = phonenumber.getLocationName('+3460724205' + ran, 'zh-CN'); 898 console.log('i18n_test_7890 ' + value1); 899 expect(value1).assertEqual('西班牙'); 900 let value2 = phonenumber.getLocationName('+34 60724205' + ran, 'zh-CN'); 901 console.log('i18n_test_7890 ' + value2); 902 expect(value2).assertEqual('西班牙'); 903 }) 904 905 /** 906 * @tc.number SUB_GLOBAL_I18N_JS_7900 907 * @tc.name test isWeekend interface 908 * @tc.desc get the isWeekend value 909 */ 910 it('i18n_test_7900', 0, function () { 911 console.log('i18n_test_7900 ' + 'start'); 912 let calendar = I18n.getCalendar('zh'); 913 let value = calendar.isWeekend(new Date(2021, 10, 1, 10, 0, 0, 0)); 914 console.log('i18n_test_7900 ' + value); 915 expect(value).assertFalse(); 916 }) 917 918 /** 919 * @tc.number SUB_GLOBAL_I18N_JS_7920 920 * @tc.name test getCalendar interface 921 * @tc.desc get the getCalendar value 922 */ 923 it('i18n_test_7920', 0, function () { 924 console.log('i18n_test_7920 ' + 'start'); 925 let calendar = I18n.getCalendar('ja', 'japanese'); 926 let name = calendar.getDisplayName('ja'); 927 console.log('i18n_test_7920 ' + name); 928 expect(name).assertEqual('和暦'); 929 let timezone = calendar.getTimeZone(); 930 console.log('i18n_test_7920 ' + timezone); 931 expect(timezone.length > 0).assertTrue(); 932 let firstday = calendar.getFirstDayOfWeek(); 933 console.log('i18n_test_7920 ' + firstday); 934 expect(firstday).assertEqual(1); 935 let miniday = calendar.getMinimalDaysInFirstWeek(); 936 console.log('i18n_test_7920 ' + miniday); 937 expect(miniday).assertEqual(1); 938 let value = calendar.isWeekend(new Date(2022, 10, 1, 10, 0, 0, 0)); 939 console.log('i18n_test_7920 ' + value); 940 expect(value).assertFalse(); 941 }) 942 943 /** 944 * @tc.number SUB_GLOBAL_I18N_JS_7940 945 * @tc.name test getCalendar interface with zh param 946 * @tc.desc get the getCalendar value 947 */ 948 it('i18n_test_7940', 0, function () { 949 console.log('i18n_test_7940 ' + 'start'); 950 let calendar = I18n.getCalendar('zh', 'chinese'); 951 let name = calendar.getDisplayName('zh'); 952 console.log('i18n_test_7940 ' + name); 953 expect(name).assertEqual('农历'); 954 }) 955 956 /** 957 * @tc.number SUB_GLOBAL_I18N_JS_7960 958 * @tc.name test getCalendar interface with zh param 959 * @tc.desc get the getCalendar value 960 */ 961 it('i18n_test_7960', 0, function () { 962 console.log('i18n_test_7960 ' + 'start'); 963 let calendar = I18n.getCalendar('zh', 'japanese'); 964 let name = calendar.getDisplayName('zh'); 965 console.log('i18n_test_7960 ' + name); 966 expect(name).assertEqual('和历'); 967 }) 968 969 /** 970 * @tc.number SUB_GLOBAL_I18N_JS_8000 971 * @tc.name test getDisplayName interface 972 * @tc.desc get the getDisplayName value 973 */ 974 it('i18n_test_8000', 0, function () { 975 console.log('i18n_test_8000 ' + 'start'); 976 let calendar = I18n.getCalendar('zh'); 977 let value = calendar.getDisplayName('zh'); 978 console.log('i18n_test_8000 ' + value); 979 expect(value).assertEqual('公历'); 980 }) 981 982 /** 983 * @tc.number SUB_GLOBAL_I18N_JS_8020 984 * @tc.name test getDisplayName interface with en param 985 * @tc.desc get the getDisplayName value 986 */ 987 it('i18n_test_8020', 0, function () { 988 console.log('i18n_test_8020 ' + 'start'); 989 let calendar = I18n.getCalendar('zh'); 990 let value = calendar.getDisplayName('en'); 991 console.log('i18n_test_8020 ' + value); 992 expect(value).assertEqual('Gregorian Calendar'); 993 }) 994 995 /** 996 * @tc.number SUB_GLOBAL_I18N_JS_8100 997 * @tc.name test get interface 998 * @tc.desc get the get value 999 */ 1000 it('i18n_test_8100', 0, function () { 1001 console.log('i18n_test_8100 ' + 'start'); 1002 let calendar = I18n.getCalendar('zh'); 1003 let value = calendar.get('year'); 1004 console.log('i18n_test_8100 ' + value); 1005 expect(value).assertLarger(0); 1006 }) 1007 1008 /** 1009 * @tc.number SUB_GLOBAL_I18N_JS_8120 1010 * @tc.name test get interface with month param 1011 * @tc.desc get the get value 1012 */ 1013 it('i18n_test_8120', 0, function () { 1014 console.log('i18n_test_8120 ' + 'start'); 1015 let calendar = I18n.getCalendar('zh'); 1016 let date1 = new Date(2021, 8, 8, 8, 8, 8, 8); 1017 calendar.setTime(date1); 1018 let value = calendar.get('month'); 1019 console.log('i18n_test_8120 ' + value); 1020 expect(value).assertEqual(8); 1021 }) 1022 1023 /** 1024 * @tc.number SUB_GLOBAL_I18N_JS_8140 1025 * @tc.name test get interface with day_of_year param 1026 * @tc.desc get the get value 1027 */ 1028 it('i18n_test_8140', 0, function () { 1029 console.log('i18n_test_8140 ' + 'start'); 1030 let calendar = I18n.getCalendar('zh'); 1031 let value = calendar.get('day_of_year'); 1032 console.log('i18n_test_8140 ' + value); 1033 expect(value).assertLarger(0); 1034 }) 1035 1036 /** 1037 * @tc.number SUB_GLOBAL_I18N_JS_8200 1038 * @tc.name test setMinimalDaysInFirstWeek and getMinimalDaysInFirstWeek interface 1039 * @tc.desc get the setMinimalDaysInFirstWeek and getMinimalDaysInFirstWeek value 1040 */ 1041 it('i18n_test_8200', 0, function () { 1042 console.log('i18n_test_8200 ' + 'start'); 1043 let calendar = I18n.getCalendar('zh'); 1044 calendar.setMinimalDaysInFirstWeek(1); 1045 let value = calendar.getMinimalDaysInFirstWeek(); 1046 console.log('i18n_test_8200 ' + value); 1047 expect(value).assertEqual(1); 1048 }) 1049 1050 /** 1051 * @tc.number SUB_GLOBAL_I18N_JS_8220 1052 * @tc.name test setMinimalDaysInFirstWeek with 0 param and getMinimalDaysInFirstWeek interface 1053 * @tc.desc get the setMinimalDaysInFirstWeek and getMinimalDaysInFirstWeek value 1054 */ 1055 it('i18n_test_8220', 0, function () { 1056 console.log('i18n_test_8220 ' + 'start'); 1057 let calendar = I18n.getCalendar('zh'); 1058 calendar.setMinimalDaysInFirstWeek(0); 1059 let value = calendar.getMinimalDaysInFirstWeek(); 1060 console.log('i18n_test_8220 ' + value); 1061 expect(value).assertEqual(1); 1062 }) 1063 1064 /** 1065 * @tc.number SUB_GLOBAL_I18N_JS_8240 1066 * @tc.name test setMinimalDaysInFirstWeek with 8 param and getMinimalDaysInFirstWeek interface 1067 * @tc.desc get the setMinimalDaysInFirstWeek and getMinimalDaysInFirstWeek value 1068 */ 1069 it('i18n_test_8240', 0, function () { 1070 console.log('i18n_test_8240 ' + 'start'); 1071 let calendar = I18n.getCalendar('zh'); 1072 calendar.setMinimalDaysInFirstWeek(8); 1073 let value = calendar.getMinimalDaysInFirstWeek(); 1074 console.log('i18n_test_8240 ' + value); 1075 expect(value).assertEqual(7); 1076 }) 1077 1078 /** 1079 * @tc.number SUB_GLOBAL_I18N_JS_8260 1080 * @tc.name test setMinimalDaysInFirstWeek with 7 param and getMinimalDaysInFirstWeek interface 1081 * @tc.desc get the setMinimalDaysInFirstWeek and getMinimalDaysInFirstWeek value 1082 */ 1083 it('i18n_test_8260', 0, function () { 1084 console.log('i18n_test_8260 ' + 'start'); 1085 let calendar = I18n.getCalendar('zh'); 1086 calendar.setMinimalDaysInFirstWeek(7); 1087 let value = calendar.getMinimalDaysInFirstWeek(); 1088 console.log('i18n_test_8260 ' + value); 1089 expect(value).assertEqual(7); 1090 }) 1091 1092 /** 1093 * @tc.number SUB_GLOBAL_I18N_JS_8300 1094 * @tc.name test setFirstDayOfWeek and getFirstDayOfWeek interface 1095 * @tc.desc get the setFirstDayOfWeek and getFirstDayOfWeek value 1096 */ 1097 it('i18n_test_8300', 0, function () { 1098 console.log('i18n_test_8300 ' + 'start'); 1099 let calendar = I18n.getCalendar('zh'); 1100 calendar.setFirstDayOfWeek(1); 1101 let value = calendar.getFirstDayOfWeek(); 1102 console.log('i18n_test_8300 ' + value); 1103 expect(value).assertEqual(1); 1104 }) 1105 1106 /** 1107 * @tc.number SUB_GLOBAL_I18N_JS_8320 1108 * @tc.name test setFirstDayOfWeek with 0 param and getFirstDayOfWeek interface 1109 * @tc.desc get the setFirstDayOfWeek and getFirstDayOfWeek value 1110 */ 1111 it('i18n_test_8320', 0, function () { 1112 console.log('i18n_test_8320 ' + 'start'); 1113 let calendar = I18n.getCalendar('zh'); 1114 calendar.setFirstDayOfWeek(0); 1115 let value = calendar.getFirstDayOfWeek(); 1116 console.log('i18n_test_8320 ' + value); 1117 expect(value).assertEqual(1); 1118 }) 1119 1120 /** 1121 * @tc.number SUB_GLOBAL_I18N_JS_8340 1122 * @tc.name test setFirstDayOfWeek with 7 param and getFirstDayOfWeek interface 1123 * @tc.desc get the setFirstDayOfWeek and getFirstDayOfWeek value 1124 */ 1125 it('i18n_test_8340', 0, function () { 1126 console.log('i18n_test_8340 ' + 'start'); 1127 let calendar = I18n.getCalendar('zh'); 1128 calendar.setFirstDayOfWeek(7); 1129 let value = calendar.getFirstDayOfWeek(); 1130 console.log('i18n_test_8340 ' + value); 1131 expect(value).assertEqual(7); 1132 }) 1133 1134 /** 1135 * @tc.number SUB_GLOBAL_I18N_JS_8360 1136 * @tc.name test setFirstDayOfWeek with 8 param and getFirstDayOfWeek interface 1137 * @tc.desc get the setFirstDayOfWeek and getFirstDayOfWeek value 1138 */ 1139 it('i18n_test_8360', 0, function () { 1140 console.log('i18n_test_8360 ' + 'start'); 1141 let calendar = I18n.getCalendar('zh'); 1142 calendar.setFirstDayOfWeek(8); 1143 let value = calendar.getFirstDayOfWeek(); 1144 console.log('i18n_test_8360 ' + value); 1145 expect(value).assertEqual(1); 1146 }) 1147 1148 /** 1149 * @tc.number SUB_GLOBAL_I18N_JS_8400 1150 * @tc.name test setTimeZone and getTimeZone interface 1151 * @tc.desc get the setTimeZone and getTimeZone value 1152 */ 1153 it('i18n_test_8400', 0, function () { 1154 console.log('i18n_test_8400 ' + 'start'); 1155 let calendar = I18n.getCalendar('zh'); 1156 calendar.setTimeZone('Asia/Shanghai'); 1157 let value = calendar.getTimeZone(); 1158 console.log('i18n_test_8400 ' + value); 1159 expect(value).assertEqual('China Standard Time'); 1160 }) 1161 1162 /** 1163 * @tc.number SUB_GLOBAL_I18N_JS_8420 1164 * @tc.name test setTimeZone with AAA param and getTimeZone interface 1165 * @tc.desc get the setTimeZone and getTimeZone value 1166 */ 1167 it('i18n_test_8420', 0, function () { 1168 console.log('i18n_test_8420 ' + 'start'); 1169 let calendar = I18n.getCalendar('zh'); 1170 calendar.setTimeZone('AAA'); 1171 let value = calendar.getTimeZone(); 1172 console.log('i18n_test_8420 ' + value); 1173 expect(value).assertEqual('GMT'); 1174 }) 1175 1176 /** 1177 * @tc.number SUB_GLOBAL_I18N_JS_8500 1178 * @tc.name test set interface 1179 * @tc.desc get the set value 1180 */ 1181 it('i18n_test_8500', 0, function () { 1182 console.log('i18n_test_8500 ' + 'start'); 1183 let calendar = I18n.getCalendar('zh'); 1184 calendar.set(2021, 11, 11); 1185 let value = calendar.isWeekend(); 1186 console.log('i18n_test_8500 ' + value); 1187 expect(value).assertTrue(); 1188 }) 1189 1190 /** 1191 * @tc.number SUB_GLOBAL_I18N_JS_8520 1192 * @tc.name test set interface with hour,minute,second param 1193 * @tc.desc get the set value 1194 */ 1195 it('i18n_test_8520', 0, function () { 1196 console.log('i18n_test_8520 ' + 'start'); 1197 let calendar = I18n.getCalendar('zh'); 1198 calendar.set(2021, 11, 11, 10, 10, 10); 1199 let value = calendar.isWeekend(); 1200 console.log('i18n_test_8520 ' + value); 1201 expect(value).assertTrue(); 1202 }) 1203 1204 /** 1205 * @tc.number SUB_GLOBAL_I18N_JS_8540 1206 * @tc.name test set interface with hour,minute param 1207 * @tc.desc get the set value 1208 */ 1209 it('i18n_test_8540', 0, function () { 1210 console.log('i18n_test_8540 ' + 'start'); 1211 let calendar = I18n.getCalendar('zh'); 1212 calendar.set(2021, 11, 11, 10, 10); 1213 let value = calendar.isWeekend(); 1214 console.log('i18n_test_8540 ' + value); 1215 expect(value).assertTrue(); 1216 }) 1217 1218 /** 1219 * @tc.number SUB_GLOBAL_I18N_JS_8600 1220 * @tc.name test setTime interface with date param 1221 * @tc.desc get the setTime value 1222 */ 1223 it('i18n_test_8600', 0, function () { 1224 console.log('i18n_test_8600 ' + 'start'); 1225 let calendar = I18n.getCalendar('zh'); 1226 //actuall month is 9 1227 let date1 = new Date(2021, 8, 8, 8, 8, 8, 8); 1228 calendar.setTime(date1); 1229 let value = calendar.isWeekend(); 1230 console.log('i18n_test_8600 ' + value); 1231 expect(value).assertFalse(); 1232 }) 1233 1234 /** 1235 * @tc.number SUB_GLOBAL_I18N_JS_8620 1236 * @tc.name test setTime interface with wrong month param 1237 * @tc.desc get the setTime value 1238 */ 1239 it('i18n_test_8620', 0, function () { 1240 console.log('i18n_test_8620 ' + 'start'); 1241 let calendar = I18n.getCalendar('zh'); 1242 let date1 = new Date(2021, 18, 8, 8, 8, 8, 8); 1243 calendar.setTime(date1); 1244 let value = calendar.isWeekend(); 1245 console.log('i18n_test_8620 ' + value); 1246 expect(value).assertFalse(); 1247 }) 1248 1249 /** 1250 * @tc.number SUB_GLOBAL_I18N_JS_8700 1251 * @tc.name test setTime interface 1252 * @tc.desc get the setTime value 1253 */ 1254 it('i18n_test_8700', 0, function () { 1255 console.log('i18n_test_8700 ' + 'start'); 1256 let calendar = I18n.getCalendar('zh'); 1257 calendar.setTime(10540800000); 1258 let value = calendar.isWeekend(); 1259 console.log('i18n_test_8700 ' + value); 1260 expect(value).assertTrue(); 1261 }) 1262 1263 /** 1264 * @tc.number SUB_GLOBAL_I18N_JS_8800 1265 * @tc.name test isRTL interface with zh-CN param 1266 * @tc.desc get the isRTL value 1267 */ 1268 it('i18n_test_8800', 0, function () { 1269 console.log('i18n_test_8800 ' + 'start'); 1270 let value = I18n.isRTL('zh-CN'); 1271 console.log('i18n_test_8800 ' + value); 1272 expect(value).assertFalse(); 1273 }) 1274 1275 /** 1276 * @tc.number SUB_GLOBAL_I18N_JS_8900 1277 * @tc.name test isRTL interface with en-US param 1278 * @tc.desc get the isRTL value 1279 */ 1280 it('i18n_test_8900', 0, function () { 1281 console.log('i18n_test_8900 ' + 'start'); 1282 let value = I18n.isRTL('en-US'); 1283 console.log('i18n_test_8900 ' + value); 1284 expect(value).assertFalse(); 1285 }) 1286 1287 /** 1288 * @tc.number SUB_GLOBAL_I18N_JS_9000 1289 * @tc.name test isRTL interface with ar param 1290 * @tc.desc get the isRTL value 1291 */ 1292 it('i18n_test_9000', 0, function () { 1293 console.log('i18n_test_9000 ' + 'start'); 1294 let value = I18n.isRTL('ar'); 1295 console.log('i18n_test_9000 ' + value); 1296 expect(value).assertTrue(); 1297 }) 1298 1299 /** 1300 * @tc.number SUB_GLOBAL_I18N_JS_9100 1301 * @tc.name test unitConvert interface from cup to liter unit with long style 1302 * @tc.desc get the unitConvert value 1303 */ 1304 it('i18n_test_9100', 0, function () { 1305 console.log('i18n_test_9100 ' + 'start'); 1306 let value = I18n.I18NUtil.unitConvert({unit: 'cup', measureSystem: 'US'}, 1307 {unit: 'liter', measureSystem: 'SI'}, 1308 1000, 1309 'en-US', 1310 'long'); 1311 console.log('i18n_test_9100 ' + value); 1312 expect(value).assertEqual('236.588 liters'); 1313 }) 1314 1315 /** 1316 * @tc.number SUB_GLOBAL_I18N_JS_9200 1317 * @tc.name test unitConvert interface from cup to liter unit with medium style 1318 * @tc.desc get the unitConvert value 1319 */ 1320 it('i18n_test_9200', 0, function () { 1321 console.log('i18n_test_9200 ' + 'start'); 1322 let value = I18n.I18NUtil.unitConvert({unit: 'cup', measureSystem: 'US'}, 1323 {unit: 'liter', measureSystem: 'SI'}, 1324 1000, 1325 'en-US', 1326 'medium'); 1327 console.log('i18n_test_9200 ' + value); 1328 expect(value).assertEqual('236.588 L'); 1329 }) 1330 1331 /** 1332 * @tc.number SUB_GLOBAL_I18N_JS_9250 1333 * @tc.name test unitConvert interface from cup to liter unit with narrow style 1334 * @tc.desc get the unitConvert value 1335 */ 1336 it('i18n_test_9250', 0, function () { 1337 console.log('i18n_test_9250 ' + 'start'); 1338 let value = I18n.I18NUtil.unitConvert({unit: 'cup', measureSystem: 'US'}, 1339 {unit: 'liter', measureSystem: 'SI'}, 1340 1000, 1341 'en-US', 1342 'narrow'); 1343 console.log('i18n_test_9250 ' + value); 1344 expect(value).assertEqual('236.588L'); 1345 }) 1346 1347 /** 1348 * @tc.number SUB_GLOBAL_I18N_JS_9300 1349 * @tc.name test unitConvert interface from cup to liter unit with short style 1350 * @tc.desc get the unitConvert value 1351 */ 1352 it('i18n_test_9300', 0, function () { 1353 console.log('i18n_test_9300 ' + 'start'); 1354 let value = I18n.I18NUtil.unitConvert({unit: 'cup', measureSystem: 'US'}, 1355 {unit: 'liter', measureSystem: 'SI'}, 1356 1000, 1357 'en-US', 1358 'short'); 1359 console.log('i18n_test_9300 ' + value); 1360 expect(value).assertEqual('236.588 L'); 1361 }) 1362 1363 /** 1364 * @tc.number SUB_GLOBAL_I18N_JS_9400 1365 * @tc.name test unitConvert interface from meter to mile unit 1366 * @tc.desc get the unitConvert value 1367 */ 1368 it('i18n_test_9400', 0, function () { 1369 console.log('i18n_test_9400 ' + 'start'); 1370 let value = I18n.I18NUtil.unitConvert({unit: 'meter', measureSystem: 'SI'}, 1371 {unit: 'mile', measureSystem: 'SI'}, 1372 1000, 1373 'zh-CN', 1374 'long'); 1375 console.log('i18n_test_9400 ' + value); 1376 expect(value).assertEqual('0.621英里'); 1377 }) 1378 1379 /** 1380 * @tc.number SUB_GLOBAL_I18N_JS_9500 1381 * @tc.name test unitConvert interface from hour to second unit 1382 * @tc.desc get the unitConvert value 1383 */ 1384 it('i18n_test_9500', 0, function () { 1385 console.log('i18n_test_9500 ' + 'start'); 1386 let value = I18n.I18NUtil.unitConvert({unit: 'hour', measureSystem: 'SI'}, 1387 {unit: 'second', measureSystem: 'SI'}, 1388 10, 1389 'zh-CN', 1390 'medium'); 1391 console.log('i18n_test_9500 ' + value); 1392 expect(value).assertEqual('36,000秒'); 1393 }) 1394 1395 /** 1396 * @tc.number SUB_GLOBAL_I18N_JS_9600 1397 * @tc.name test unitConvert interface from celsius to fahrenheit unit 1398 * @tc.desc get the unitConvert value 1399 */ 1400 it('i18n_test_9600', 0, function () { 1401 console.log('i18n_test_9600 ' + 'start'); 1402 let value = I18n.I18NUtil.unitConvert({unit: 'celsius', measureSystem: 'SI'}, 1403 {unit: 'fahrenheit', measureSystem: 'SI'}, 1404 1000, 1405 'zh-CN', 1406 'short'); 1407 console.log('i18n_test_9600 ' + value); 1408 expect(value).assertEqual('1,832°F'); 1409 }) 1410 1411 /** 1412 * @tc.number SUB_GLOBAL_I18N_JS_9700 1413 * @tc.name test unitConvert interface from acre to hectare unit 1414 * @tc.desc get the unitConvert value 1415 */ 1416 it('i18n_test_9700', 0, function () { 1417 console.log('i18n_test_9700 ' + 'start'); 1418 let value = I18n.I18NUtil.unitConvert({unit: 'acre', measureSystem: 'SI'}, 1419 {unit: 'hectare', measureSystem: 'SI'}, 1420 1000, 1421 'zh-CN', 1422 'long'); 1423 console.log('i18n_test_9700 ' + value); 1424 expect(value).assertEqual('404.686公顷'); 1425 }) 1426 1427 /** 1428 * @tc.number SUB_GLOBAL_I18N_JS_9710 1429 * @tc.name test unitConvert interface from acre to square-meter unit 1430 * @tc.desc get the unitConvert value 1431 */ 1432 it('i18n_test_9710', 0, function () { 1433 console.log('i18n_test_9710 ' + 'start'); 1434 let value = I18n.I18NUtil.unitConvert({unit: 'acre', measureSystem: 'SI'}, 1435 {unit: 'square-meter', measureSystem: 'SI'}, 1436 1000, 1437 'zh-CN', 1438 'long'); 1439 console.log('i18n_test_9710 ' + value); 1440 expect(value).assertEqual('4,046,856.422平方米'); 1441 }) 1442 1443 /** 1444 * @tc.number SUB_GLOBAL_I18N_JS_9800 1445 * @tc.name test unitConvert interface from kilometer-per-hour to knot unit 1446 * @tc.desc get the unitConvert value 1447 */ 1448 it('i18n_test_9800', 0, function () { 1449 console.log('i18n_test_9800 ' + 'start'); 1450 let value = I18n.I18NUtil.unitConvert({unit: 'kilometer-per-hour', measureSystem: 'SI'}, 1451 {unit: 'knot', measureSystem: 'SI'}, 1452 1000, 1453 'zh-CN', 1454 'long'); 1455 console.log('i18n_test_9800 ' + value); 1456 expect(value).assertEqual('539.957节'); 1457 }) 1458 1459 /** 1460 * @tc.number SUB_GLOBAL_I18N_JS_9850 1461 * @tc.name test unitConvert interface from kilometer-per-hour to meter-per-second unit 1462 * @tc.desc get the unitConvert value 1463 */ 1464 it('i18n_test_9850', 0, function () { 1465 console.log('i18n_test_9850 ' + 'start'); 1466 let value = I18n.I18NUtil.unitConvert({unit: 'kilometer-per-hour', measureSystem: 'SI'}, 1467 {unit: 'meter-per-second', measureSystem: 'SI'}, 1468 1000, 1469 'zh-CN', 1470 'long'); 1471 console.log('i18n_test_9850 ' + value); 1472 expect(value).assertEqual('每秒277.778米'); 1473 }) 1474 1475 /** 1476 * @tc.number SUB_GLOBAL_I18N_JS_9900 1477 * @tc.name test unitConvert interface from meter to kilometer unit 1478 * @tc.desc get the unitConvert value 1479 */ 1480 it('i18n_test_9900', 0, function () { 1481 console.log('i18n_test_9900 ' + 'start'); 1482 let value = I18n.I18NUtil.unitConvert({unit: 'meter', measureSystem: 'SI'}, 1483 {unit: 'kilometer', measureSystem: 'SI'}, 1484 1000, 1485 'zh-CN', 1486 'long'); 1487 console.log('i18n_test_9900 ' + value); 1488 expect(value).assertEqual('1公里'); 1489 }) 1490 1491 /** 1492 * @tc.number SUB_GLOBAL_I18N_JS_9910 1493 * @tc.name test unitConvert interface from meter to meter-per-second unit 1494 * @tc.desc get the unitConvert value 1495 */ 1496 it('i18n_test_9910', 0, function () { 1497 console.log('i18n_test_9910 ' + 'start'); 1498 let value = I18n.I18NUtil.unitConvert({unit: 'meter', measureSystem: 'SI'}, 1499 {unit: 'meter-per-second', measureSystem: 'SI'}, 1500 1000, 1501 'zh-CN', 1502 'long'); 1503 console.log('i18n_test_9910 ' + value); 1504 expect(value).assertEqual('1,000米'); 1505 }) 1506 1507 /* * 1508 * @tc.number SUB_GLOBAL_I18N_JS_BREAKITERATOR_0100 1509 * @tc.name test current interface 1510 * @tc.desc check the current result 1511 */ 1512 it('i18n_test_iterator_0100', 0, function () { 1513 console.log('i18n_test_iterator_0100 ' + 'start'); 1514 let iterator =I18n.getLineInstance('en'); 1515 iterator.setLineBreakText('My name is Tom.Welcome to the sky world.'); 1516 let value = iterator.current(); 1517 console.log('i18n_test_iterator_0100 ' + value); 1518 expect(value).assertEqual(0); 1519 }) 1520 1521 /* * 1522 * @tc.number SUB_GLOBAL_I18N_JS_BREAKITERATOR_0200 1523 * @tc.name test first interface 1524 * @tc.desc check the first 1525 */ 1526 it('i18n_test_iterator_0200', 0, function () { 1527 console.log('i18n_test_iterator_0200 ' + 'start'); 1528 let iterator =I18n.getLineInstance('en'); 1529 iterator.setLineBreakText('My name is Tom.Welcome to the sky world.'); 1530 let value = iterator.first(); 1531 console.log('i18n_test_iterator_0200 ' + value); 1532 expect(value).assertEqual(0); 1533 }) 1534 1535 /* * 1536 * @tc.number SUB_GLOBAL_I18N_JS_BREAKITERATOR_0300 1537 * @tc.name test last interface 1538 * @tc.desc check the last interface 1539 */ 1540 it('i18n_test_iterator_0300', 0, function () { 1541 console.log('i18n_test_iterator_0300 ' + 'start'); 1542 let iterator =I18n.getLineInstance('en'); 1543 iterator.setLineBreakText('My name is Tom.Welcome to the sky world.'); 1544 let value = iterator.last(); 1545 console.log('i18n_test_iterator_0300 ' + value); 1546 expect(value).assertEqual(40); 1547 }) 1548 1549 /* * 1550 * @tc.number SUB_GLOBAL_I18N_JS_BREAKITERATOR_0400 1551 * @tc.name test next interface 1552 * @tc.desc check the next interface 1553 */ 1554 it('i18n_test_iterator_0400', 0, function () { 1555 console.log('i18n_test_iterator_0400 ' + 'start'); 1556 let iterator =I18n.getLineInstance('en'); 1557 iterator.setLineBreakText('My name is Tom.Welcome to the sky world.'); 1558 let value = iterator.next(); 1559 console.log('i18n_test_iterator_0400 ' + value); 1560 expect(value).assertEqual(3); 1561 }) 1562 1563 /* * 1564 * @tc.number SUB_GLOBAL_I18N_JS_BREAKITERATOR_0500 1565 * @tc.name test next interface with param 1566 * @tc.desc check the next interface with param 1567 */ 1568 it('i18n_test_iterator_0500', 0, function () { 1569 console.log('i18n_test_iterator_0500 ' + 'start'); 1570 let iterator =I18n.getLineInstance('en'); 1571 iterator.setLineBreakText('My name is Tom.Welcome to the sky world.'); 1572 let value = iterator.next(2); 1573 console.log('i18n_test_iterator_0500 ' + value); 1574 expect(value).assertEqual(8); 1575 }) 1576 1577 /* * 1578 * @tc.number SUB_GLOBAL_I18N_JS_BREAKITERATOR_0600 1579 * @tc.name test previous interface 1580 * @tc.desc check the previous interface 1581 */ 1582 it('i18n_test_iterator_0600', 0, function () { 1583 console.log('i18n_test_iterator_0600 ' + 'start'); 1584 let iterator =I18n.getLineInstance('en'); 1585 iterator.setLineBreakText('My name is Tom.Welcome to the sky world.'); 1586 let value = iterator.previous(); 1587 console.log('i18n_test_iterator_0600 ' + value); 1588 expect(value).assertEqual(-1); 1589 }) 1590 1591 /* * 1592 * @tc.number SUB_GLOBAL_I18N_JS_BREAKITERATOR_0700 1593 * @tc.name test following interface 1594 * @tc.desc check the following interface 1595 */ 1596 it('i18n_test_iterator_0700', 0, function () { 1597 console.log('i18n_test_iterator_0700 ' + 'start'); 1598 let iterator =I18n.getLineInstance('en'); 1599 iterator.setLineBreakText('My name is Tom.Welcome to the sky world.'); 1600 let value = iterator.following(1); 1601 console.log('i18n_test_iterator_0700 ' + value); 1602 expect(value).assertEqual(3); 1603 }) 1604 1605 /* * 1606 * @tc.number SUB_GLOBAL_I18N_JS_BREAKITERATOR_0800 1607 * @tc.name test getLineBreakText interface 1608 * @tc.desc check the getLineBreakText interface 1609 */ 1610 it('i18n_test_iterator_0800', 0, function () { 1611 console.log('i18n_test_iterator_0800 ' + 'start'); 1612 let iterator =I18n.getLineInstance('en'); 1613 iterator.setLineBreakText('My name is Tom.Welcome to the sky world.'); 1614 let value = iterator.getLineBreakText(); 1615 console.log('i18n_test_iterator_0800 ' + value); 1616 expect(value).assertEqual('My name is Tom.Welcome to the sky world.'); 1617 }) 1618 1619 /* * 1620 * @tc.number SUB_GLOBAL_I18N_JS_BREAKITERATOR_0900 1621 * @tc.name test isBoundary interface 1622 * @tc.desc check the isBoundary interface 1623 */ 1624 it('i18n_test_iterator_0900', 0, function () { 1625 console.log('i18n_test_iterator_0900 ' + 'start'); 1626 let iterator =I18n.getLineInstance('en'); 1627 iterator.setLineBreakText('My name is Tom.Welcome to the sky world.'); 1628 let value = iterator.isBoundary(10); 1629 console.log('i18n_test_iterator_0900 ' + value); 1630 expect(value).assertFalse(); 1631 // current 1632 let current = iterator.current(); 1633 console.log('i18n_test_iterator_0900 ' + current); 1634 expect(current).assertEqual(11); 1635 }) 1636 1637 /* * 1638 * @tc.number SUB_GLOBAL_I18N_JS_BREAKITERATOR_1000 1639 * @tc.name test iterator interface 1640 * @tc.desc check the iterator interface 1641 */ 1642 it('i18n_test_iterator_1000', 0, function () { 1643 console.log('i18n_test_iterator_1000 ' + 'start'); 1644 let iterator =I18n.getLineInstance('en'); 1645 iterator.setLineBreakText('My name is Tom.Welcome to the sky world.'); 1646 // current 1647 let current = iterator.current(); 1648 console.log('i18n_test_iterator_1000 ' + current); 1649 expect(current).assertEqual(0); 1650 // next 1651 let next = iterator.next(); 1652 console.log('i18n_test_iterator_1000 ' + next); 1653 expect(next).assertEqual(3); 1654 // current 1655 let current2 = iterator.current(); 1656 console.log('i18n_test_iterator_1000 ' + current2); 1657 expect(current2).assertEqual(3); 1658 // next 5 1659 let next2 = iterator.next(5); 1660 console.log('i18n_test_iterator_1000 ' + next2); 1661 expect(next2).assertEqual(30); 1662 // previous 1663 let previous = iterator.previous(); 1664 console.log('i18n_test_iterator_1000 ' + previous); 1665 expect(previous).assertEqual(26); 1666 // following 2 1667 let follwoing = iterator.following(3); 1668 console.log('i18n_test_iterator_1000 ' + follwoing); 1669 expect(follwoing).assertEqual(8); 1670 // current 1671 let current3 = iterator.current(); 1672 console.log('i18n_test_iterator_1000 ' + current3); 1673 expect(current3).assertEqual(8); 1674 // isBoundary 1675 let value = iterator.isBoundary(3); 1676 console.log('i18n_test_iterator_1000 ' + value); 1677 expect(value).assertTrue(); 1678 // current 1679 let current4 = iterator.current(); 1680 console.log('i18n_test_iterator_1000 ' + current4); 1681 expect(current4).assertEqual(3); 1682 1683 }) 1684 1685 /* * 1686 * @tc.number SUB_GLOBAL_I18N_JS_INDEXUTIL_0100 1687 * @tc.name test getIndex interface 1688 * @tc.desc check the getIndex interface 1689 */ 1690 it('i18n_test_indexutil_0100', 0, function () { 1691 console.log('i18n_test_indexutil_0100 ' + 'start'); 1692 let index = I18n.getInstance(); 1693 let value = index.getIndex('a'); 1694 console.log('i18n_test_indexutil_0100 ' + value); 1695 expect(value).assertEqual('A'); 1696 }) 1697 1698 /* * 1699 * @tc.number SUB_GLOBAL_I18N_JS_INDEXUTIL_0200 1700 * @tc.name test getIndexList interface 1701 * @tc.desc check the getIndexList interface 1702 */ 1703 it('i18n_test_indexutil_0200', 0, function () { 1704 console.log('i18n_test_indexutil_0200 ' + 'start'); 1705 let index = I18n.getInstance(); 1706 let value = index.getIndexList(); 1707 let len = value.length; 1708 console.log('i18n_test_indexutil_0200 ' + value); 1709 expect(len).assertLarger(0); 1710 }) 1711 1712 /* * 1713 * @tc.number SUB_GLOBAL_I18N_JS_INDEXUTIL_0300 1714 * @tc.name test addLocale interface 1715 * @tc.desc check the addLocale interface 1716 */ 1717 it('i18n_test_indexutil_0300', 0, function () { 1718 console.log('i18n_test_indexutil_0300 ' + 'start'); 1719 let index = I18n.getInstance(); 1720 index.addLocale('en'); 1721 let value = index.getIndex('a'); 1722 console.log('i18n_test_indexutil_0300 ' + value); 1723 expect(value).assertEqual('A'); 1724 }) 1725 1726 /* * 1727 * @tc.number SUB_GLOBAL_I18N_JS_INDEXUTIL_0400 1728 * @tc.name test getInstance interface with zh locale 1729 * @tc.desc check the getInstance interface with zh locale 1730 */ 1731 it('i18n_test_indexutil_0400', 0, function () { 1732 console.log('i18n_test_indexutil_0400 ' + 'start'); 1733 let index = I18n.getInstance('zh'); 1734 let value = index.getIndex('z'); 1735 console.log('i18n_test_indexutil_0400 ' + value); 1736 expect(value).assertEqual('Z'); 1737 }) 1738 1739 /* * 1740 * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0100 1741 * @tc.name test isDigit interface 1742 * @tc.desc check the isDigit interface 1743 */ 1744 it('i18n_test_character_0100', 0, function () { 1745 console.log('i18n_test_character_0100 ' + 'start'); 1746 let value = I18n.Unicode.isDigit('abc'); 1747 console.log('i18n_test_character_0100 ' + value); 1748 expect(value).assertFalse(); 1749 }) 1750 1751 /* * 1752 * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0120 1753 * @tc.name test isDigit interface with 123 param 1754 * @tc.desc check the isDigit interface 1755 */ 1756 it('i18n_test_character_0120', 0, function () { 1757 console.log('i18n_test_character_0120 ' + 'start'); 1758 let value = I18n.Unicode.isDigit('123'); 1759 console.log('i18n_test_character_0120 ' + value); 1760 expect(value).assertTrue(); 1761 }) 1762 1763 /* * 1764 * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0140 1765 * @tc.name test isDigit interface with 123abc param 1766 * @tc.desc check the isDigit interface 1767 */ 1768 it('i18n_test_character_0140', 0, function () { 1769 console.log('i18n_test_character_0140 ' + 'start'); 1770 let value = I18n.Unicode.isDigit('123abc'); 1771 console.log('i18n_test_character_0140 ' + value); 1772 expect(value).assertTrue(); 1773 }) 1774 1775 /* * 1776 * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0150 1777 * @tc.name test isDigit interface with abc123 param 1778 * @tc.desc check the isDigit interface 1779 */ 1780 it('i18n_test_character_0150', 0, function () { 1781 console.log('i18n_test_character_0150 ' + 'start'); 1782 let value = I18n.Unicode.isDigit('abc123'); 1783 console.log('i18n_test_character_0150 ' + value); 1784 expect(value).assertFalse(); 1785 }) 1786 1787 /* * 1788 * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0160 1789 * @tc.name test isDigit interface with null param 1790 * @tc.desc check the isDigit interface 1791 */ 1792 it('i18n_test_character_0160', 0, function () { 1793 console.log('i18n_test_character_0160 ' + 'start'); 1794 let value = I18n.Unicode.isDigit(''); 1795 console.log('i18n_test_character_0160 ' + value); 1796 expect(value).assertFalse(); 1797 }) 1798 1799 /* * 1800 * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0200 1801 * @tc.name test isSpaceChar interface with abc param 1802 * @tc.desc check the isSpaceChar interface 1803 */ 1804 it('i18n_test_character_0200', 0, function () { 1805 console.log('i18n_test_character_0200 ' + 'start'); 1806 let value = I18n.Unicode.isSpaceChar('abc'); 1807 console.log('i18n_test_character_0200 ' + value); 1808 expect(value).assertFalse(); 1809 }) 1810 1811 /* * 1812 * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0220 1813 * @tc.name test isSpaceChar interface with one space param 1814 * @tc.desc check the isSpaceChar interface 1815 */ 1816 it('i18n_test_character_0220', 0, function () { 1817 console.log('i18n_test_character_0220 ' + 'start'); 1818 let value = I18n.Unicode.isSpaceChar(' '); 1819 console.log('i18n_test_character_0220 ' + value); 1820 expect(value).assertTrue(); 1821 }) 1822 1823 /* * 1824 * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0240 1825 * @tc.name test isSpaceChar interface with multi space param 1826 * @tc.desc check the isSpaceChar interface 1827 */ 1828 it('i18n_test_character_0240', 0, function () { 1829 console.log('i18n_test_character_0240 ' + 'start'); 1830 let value = I18n.Unicode.isSpaceChar(' '); 1831 console.log('i18n_test_character_0240--' + value + '--'); 1832 expect(value).assertTrue(); 1833 }) 1834 1835 /* * 1836 * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0300 1837 * @tc.name test isWhitespace interface with abc param 1838 * @tc.desc check the isWhitespace interface 1839 */ 1840 it('i18n_test_character_0300', 0, function () { 1841 console.log('i18n_test_character_0300 ' + 'start'); 1842 let value = I18n.Unicode.isWhitespace('abc'); 1843 console.log('i18n_test_character_0300 ' + value); 1844 expect(value).assertFalse(); 1845 }) 1846 1847 /* * 1848 * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0320 1849 * @tc.name test isWhitespace interface with \u0009 param 1850 * @tc.desc check the isWhitespace interface 1851 */ 1852 it('i18n_test_character_0320', 0, function () { 1853 console.log('i18n_test_character_0320 ' + 'start'); 1854 let value = I18n.Unicode.isWhitespace('\u0009'); 1855 console.log('i18n_test_character_0320--' + value + '--'); 1856 expect(value).assertTrue(); 1857 }) 1858 1859 /* * 1860 * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0400 1861 * @tc.name test isRTL interface with abc param 1862 * @tc.desc check the isRTL interface 1863 */ 1864 it('i18n_test_character_0400', 0, function () { 1865 console.log('i18n_test_character_0400 ' + 'start'); 1866 let value = I18n.Unicode.isRTL('abc'); 1867 console.log('i18n_test_character_0400 ' + value); 1868 expect(value).assertFalse(); 1869 }) 1870 1871 /* * 1872 * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0420 1873 * @tc.name test isRTL interface with ١٢٣٤٥٦٧ param 1874 * @tc.desc check the isRTL interface 1875 */ 1876 it('i18n_test_character_0420', 0, function () { 1877 console.log('i18n_test_character_0420 ' + 'start'); 1878 let value = I18n.Unicode.isRTL('١٢٣٤٥٦٧'); 1879 console.log('i18n_test_character_0420 ' + value); 1880 expect(value).assertFalse(); 1881 }) 1882 1883 /* * 1884 * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0440 1885 * @tc.name test isRTL interface with 我是小明 param 1886 * @tc.desc check the isRTL interface 1887 */ 1888 it('i18n_test_character_0440', 0, function () { 1889 console.log('i18n_test_character_0440 ' + 'start'); 1890 let value = I18n.Unicode.isRTL('我是小明'); 1891 console.log('i18n_test_character_0440 ' + value); 1892 expect(value).assertFalse(); 1893 }) 1894 1895 /* * 1896 * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0460 1897 * @tc.name test isRTL interface with نحن param 1898 * @tc.desc check the isRTL interface 1899 */ 1900 it('i18n_test_character_0460', 0, function () { 1901 console.log('i18n_test_character_0460 ' + 'start'); 1902 let value = I18n.Unicode.isRTL('نحن'); 1903 console.log('i18n_test_character_0460 ' + value); 1904 expect(value).assertTrue(); 1905 }) 1906 1907 /* * 1908 * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0500 1909 * @tc.name test isIdeograph interface with abc param 1910 * @tc.desc check the isIdeograph interface 1911 */ 1912 it('i18n_test_character_0500', 0, function () { 1913 console.log('i18n_test_character_0500 ' + 'start'); 1914 let value = I18n.Unicode.isIdeograph('abc'); 1915 console.log('i18n_test_character_0500 ' + value); 1916 expect(value).assertFalse(); 1917 }) 1918 1919 /* * 1920 * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0520 1921 * @tc.name test isIdeograph interface with '我' param 1922 * @tc.desc check the isIdeograph interface 1923 */ 1924 it('i18n_test_character_0520', 0, function () { 1925 console.log('i18n_test_character_0520 ' + 'start'); 1926 let value = I18n.Unicode.isIdeograph('我'); 1927 console.log('i18n_test_character_0520 ' + value); 1928 expect(value).assertTrue(); 1929 }) 1930 1931 /* * 1932 * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0540 1933 * @tc.name test isIdeograph interface with '우리' param 1934 * @tc.desc check the isIdeograph interface 1935 */ 1936 it('i18n_test_character_0540', 0, function () { 1937 console.log('i18n_test_character_0540 ' + 'start'); 1938 let value = I18n.Unicode.isIdeograph('우리'); 1939 console.log('i18n_test_character_0540 ' + value); 1940 expect(value).assertFalse(); 1941 }) 1942 1943 /* * 1944 * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0560 1945 * @tc.name test isIdeograph interface with '私た' param 1946 * @tc.desc check the isIdeograph interface 1947 */ 1948 it('i18n_test_character_0560', 0, function () { 1949 console.log('i18n_test_character_0560 ' + 'start'); 1950 let value = I18n.Unicode.isIdeograph('私たち'); 1951 console.log('i18n_test_character_0560 ' + value); 1952 expect(value).assertTrue(); 1953 }) 1954 1955 /* * 1956 * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0600 1957 * @tc.name test isLetter interface with abc param 1958 * @tc.desc check the isLetter interface 1959 */ 1960 it('i18n_test_character_0600', 0, function () { 1961 console.log('i18n_test_character_0600 ' + 'start'); 1962 let value = I18n.Unicode.isLetter('abc'); 1963 console.log('i18n_test_character_0600 ' + value); 1964 expect(value).assertTrue(); 1965 }) 1966 1967 /* * 1968 * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0620 1969 * @tc.name test isLetter interface with 123 param 1970 * @tc.desc check the isLetter interface 1971 */ 1972 it('i18n_test_character_0620', 0, function () { 1973 console.log('i18n_test_character_0620 ' + 'start'); 1974 let value = I18n.Unicode.isLetter('123'); 1975 console.log('i18n_test_character_0620 ' + value); 1976 expect(value).assertFalse(); 1977 }) 1978 1979 /* * 1980 * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0640 1981 * @tc.name test isLetter interface with abc123 param 1982 * @tc.desc check the isLetter interface 1983 */ 1984 it('i18n_test_character_0640', 0, function () { 1985 console.log('i18n_test_character_0640 ' + 'start'); 1986 let value = I18n.Unicode.isLetter('abc123'); 1987 console.log('i18n_test_character_0640 ' + value); 1988 expect(value).assertTrue(); 1989 }) 1990 1991 /* * 1992 * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0660 1993 * @tc.name test isLetter interface with 123abc param 1994 * @tc.desc check the isLetter interface 1995 */ 1996 it('i18n_test_character_0660', 0, function () { 1997 console.log('i18n_test_character_0660 ' + 'start'); 1998 let value = I18n.Unicode.isLetter('123abc'); 1999 console.log('i18n_test_character_0660 ' + value); 2000 expect(value).assertFalse(); 2001 }) 2002 2003 /* * 2004 * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0700 2005 * @tc.name test isLowerCase interface with abc param 2006 * @tc.desc check the isLowerCase interface 2007 */ 2008 it('i18n_test_character_0700', 0, function () { 2009 console.log('i18n_test_character_0700 ' + 'start'); 2010 let value = I18n.Unicode.isLowerCase('abc'); 2011 console.log('i18n_test_character_0700 ' + value); 2012 expect(value).assertTrue(); 2013 }) 2014 2015 /* * 2016 * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0720 2017 * @tc.name ftest isLowerCase interface with ABC param 2018 * @tc.desc check the isLowerCase interface 2019 */ 2020 it('i18n_test_character_0720', 0, function () { 2021 console.log('i18n_test_character_0720 ' + 'start'); 2022 let value = I18n.Unicode.isLowerCase('ABC'); 2023 console.log('i18n_test_character_0720 ' + value); 2024 expect(value).assertFalse(); 2025 }) 2026 2027 /* * 2028 * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0740 2029 * @tc.name test isLowerCase interface with abcDEF param 2030 * @tc.desc check the isLowerCase interface 2031 */ 2032 it('i18n_test_character_0740', 0, function () { 2033 console.log('i18n_test_character_0740 ' + 'start'); 2034 let value = I18n.Unicode.isLowerCase('abcDEF'); 2035 console.log('i18n_test_character_0740 ' + value); 2036 expect(value).assertTrue(); 2037 }) 2038 2039 /* * 2040 * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0760 2041 * @tc.name test isLowerCase interface with ABCdef param 2042 * @tc.desc check the isLowerCase interface 2043 */ 2044 it('i18n_test_character_0760', 0, function () { 2045 console.log('i18n_test_character_0760 ' + 'start'); 2046 let value = I18n.Unicode.isLowerCase('ABCdef'); 2047 console.log('i18n_test_character_0760 ' + value); 2048 expect(value).assertFalse(); 2049 }) 2050 2051 /* * 2052 * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0800 2053 * @tc.name test isUpperCase interface with ABC param 2054 * @tc.desc check the isUpperCase interface 2055 */ 2056 it('i18n_test_character_0800', 0, function () { 2057 console.log('i18n_test_character_0800 ' + 'start'); 2058 let value = I18n.Unicode.isUpperCase('ABC'); 2059 console.log('i18n_test_character_0800 ' + value); 2060 expect(value).assertTrue(); 2061 }) 2062 2063 /* * 2064 * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0820 2065 * @tc.name test isUpperCase interface with abc param 2066 * @tc.desc check the isUpperCase interface 2067 */ 2068 it('i18n_test_character_0820', 0, function () { 2069 console.log('i18n_test_character_0820 ' + 'start'); 2070 let value = I18n.Unicode.isUpperCase('abc'); 2071 console.log('i18n_test_character_0820 ' + value); 2072 expect(value).assertFalse(); 2073 }) 2074 2075 /* * 2076 * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0840 2077 * @tc.name test isUpperCase interface with ABCdef param 2078 * @tc.desc check the isUpperCase interface 2079 */ 2080 it('i18n_test_character_0840', 0, function () { 2081 console.log('i18n_test_character_0840 ' + 'start'); 2082 let value = I18n.Unicode.isUpperCase('ABCdef'); 2083 console.log('i18n_test_character_0840 ' + value); 2084 expect(value).assertTrue(); 2085 }) 2086 2087 /* * 2088 * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0860 2089 * @tc.name test isUpperCase interface with abcDEF param 2090 * @tc.desc check the isUpperCase interface 2091 */ 2092 it('i18n_test_character_0860', 0, function () { 2093 console.log('i18n_test_character_0860 ' + 'start'); 2094 let value = I18n.Unicode.isUpperCase('abcDEF'); 2095 console.log('i18n_test_character_0860 ' + value); 2096 expect(value).assertFalse(); 2097 }) 2098 2099 /* * 2100 * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0900 2101 * @tc.name test getType interface with a param 2102 * @tc.desc check the getType interface 2103 */ 2104 it('i18n_test_character_0900', 0, function () { 2105 console.log('i18n_test_character_0900 ' + 'start'); 2106 let value = I18n.Unicode.getType('a'); 2107 console.log('i18n_test_character_0900 ' + value); 2108 expect(value).assertEqual('U_LOWERCASE_LETTER'); 2109 }) 2110 2111 /* * 2112 * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0920 2113 * @tc.name ftest getType interface with ABC param 2114 * @tc.desc check the getType interface 2115 */ 2116 it('i18n_test_character_0920', 0, function () { 2117 console.log('i18n_test_character_0920 ' + 'start'); 2118 let value = I18n.Unicode.getType('ABC'); 2119 console.log('i18n_test_character_0920 ' + value); 2120 expect(value).assertEqual('U_UPPERCASE_LETTER'); 2121 }) 2122 2123 /* * 2124 * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0940 2125 * @tc.name test getType interface with ABCdef param 2126 * @tc.desc check the getType interface 2127 */ 2128 it('i18n_test_character_0940', 0, function () { 2129 console.log('i18n_test_character_0940 ' + 'start'); 2130 let value = I18n.Unicode.getType('ABCdef'); 2131 console.log('i18n_test_character_0940 ' + value); 2132 expect(value).assertEqual('U_UPPERCASE_LETTER'); 2133 }) 2134 2135 /* * 2136 * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0960 2137 * @tc.name test getType interface with 123 param 2138 * @tc.desc check the getType interface 2139 */ 2140 it('i18n_test_character_0960', 0, function () { 2141 console.log('i18n_test_character_0960 ' + 'start'); 2142 let value = I18n.Unicode.getType('123'); 2143 console.log('i18n_test_character_0960 ' + value); 2144 expect(value).assertEqual('U_DECIMAL_DIGIT_NUMBER'); 2145 }) 2146 2147 /* * 2148 * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0970 2149 * @tc.name test getType interface with 123abc param 2150 * @tc.desc check the getType interface 2151 */ 2152 it('i18n_test_character_0970', 0, function () { 2153 console.log('i18n_test_character_0970 ' + 'start'); 2154 let value = I18n.Unicode.getType('123abc'); 2155 console.log('i18n_test_character_0970 ' + value); 2156 expect(value).assertEqual('U_DECIMAL_DIGIT_NUMBER'); 2157 }) 2158 2159 /* * 2160 * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0980 2161 * @tc.name test getType interface with ١٢٣٤٥٦٧ param 2162 * @tc.desc check the getType interface 2163 */ 2164 it('i18n_test_character_0980', 0, function () { 2165 console.log('i18n_test_character_0980 ' + 'start'); 2166 let value = I18n.Unicode.getType('١٢٣٤٥٦٧'); 2167 console.log('i18n_test_character_0980 ' + value); 2168 expect(value).assertEqual('U_DECIMAL_DIGIT_NUMBER'); 2169 }) 2170 2171 /* * 2172 * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0990 2173 * @tc.name test getType interface with multi space param 2174 * @tc.desc check the getType interface 2175 */ 2176 it('i18n_test_character_0990', 0, function () { 2177 console.log('i18n_test_character_0990 ' + 'start'); 2178 let value = I18n.Unicode.getType(' '); 2179 console.log('i18n_test_character_0990 ' + value); 2180 expect(value).assertEqual('U_SPACE_SEPARATOR'); 2181 }) 2182 2183 console.log('*************end I18NTest*************'); 2184})} 2185