diff --git a/global/i18n_standard/intljs/BUILD.gn b/global/i18n_standard/intljs/BUILD.gn
old mode 100755
new mode 100644
index e360d7a628c332dbfc2c84f0d9a3f7f1973792c0..8c39313bb41206f898474e24d6129dfa2682a7fd
--- a/global/i18n_standard/intljs/BUILD.gn
+++ b/global/i18n_standard/intljs/BUILD.gn
@@ -9,7 +9,7 @@
# 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.
+# limitations under the License.
import("//test/xts/tools/build/suite.gni")
@@ -23,7 +23,9 @@ ohos_js_hap_suite("intljs_test") {
hap_name = "ActsIntlJsTest"
}
ohos_js_assets("intljs_assets") {
- source_dir = "./src/main/js/default"
+ js2abc = true
+ hap_profile = "./src/main/config.json"
+ source_dir = "./src/main/js"
}
ohos_resources("intljs_resources") {
sources = [ "./src/main/resources" ]
diff --git a/global/i18n_standard/intljs/Test.json b/global/i18n_standard/intljs/Test.json
old mode 100755
new mode 100644
index 95c80aa85927be171ed566a6d1669b32af49eebc..2839fb01d953a68d9aa996ba969bfe49a3945812
--- a/global/i18n_standard/intljs/Test.json
+++ b/global/i18n_standard/intljs/Test.json
@@ -1,30 +1,31 @@
-{
- "description": "Configuration for intljs Tests",
- "driver": {
- "type": "JSUnitTest",
- "test-timeout": "300000",
- "package": "ohos.intl.test",
- "shell-timeout": "60000"
- },
- "kits": [
- {
- "test-file-name": [
- "ActsIntlJsTest.hap"
- ],
- "type": "AppInstallKit",
- "cleanup-apps": true
- },
- {
- "type": "PushKit",
- "push": [
- "resource/global/white_languages.xml->/system/usr/ohos_locale_config/white_languages.xml"
- ]
- },
- {
- "type": "ShellKit",
- "run-command": [
- "chmod 644 /system/usr/ohos_locale_config/white_languages.xml"
- ]
- }
- ]
-}
+{
+ "description": "Configuration for intljs Tests",
+ "driver": {
+ "type": "OHJSUnitTest",
+ "test-timeout": "300000",
+ "shell-timeout": "300000",
+ "bundle-name": "ohos.intl.test",
+ "package-name": "ohos.intl.test"
+ },
+ "kits": [
+ {
+ "test-file-name": [
+ "ActsIntlJsTest.hap"
+ ],
+ "type": "AppInstallKit",
+ "cleanup-apps": true
+ },
+ {
+ "type": "PushKit",
+ "push": [
+ "resource/global/white_languages.xml->/system/usr/ohos_locale_config/white_languages.xml"
+ ]
+ },
+ {
+ "type": "ShellKit",
+ "run-command": [
+ "chmod 644 /system/usr/ohos_locale_config/white_languages.xml"
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/global/i18n_standard/intljs/signature/openharmony_sx.p7b b/global/i18n_standard/intljs/signature/openharmony_sx.p7b
old mode 100755
new mode 100644
diff --git a/global/i18n_standard/intljs/src/main/config.json b/global/i18n_standard/intljs/src/main/config.json
old mode 100755
new mode 100644
index 58c51dbd9dbd7b60fcc43f5e07f87bf675e93f72..f1808af3f5379c4e1e1a9e98a3f72eff3258e724
--- a/global/i18n_standard/intljs/src/main/config.json
+++ b/global/i18n_standard/intljs/src/main/config.json
@@ -1,70 +1,103 @@
-{
- "app": {
- "bundleName": "ohos.intl.test",
- "vendor": "example",
- "version": {
- "code": 1,
- "name": "1.0"
- },
- "apiVersion": {
- "compatible": 4,
- "target": 5
- }
- },
- "deviceConfig": {},
- "module": {
- "package": "ohos.intl.test",
- "name": ".MyApplication",
- "deviceType": [
- "phone"
- ],
- "distro": {
- "deliveryWithInstall": true,
- "moduleName": "entry",
- "moduleType": "entry"
- },
- "abilities": [
- {
- "visible": true,
- "skills": [
- {
- "entities": [
- "entity.system.home"
- ],
- "actions": [
- "action.system.home"
- ]
- }
- ],
- "name": "ohos.intl.test.MainAbility",
- "icon": "$media:icon",
- "description": "$string:mainability_description",
- "label": "MyApplication",
- "type": "page",
- "launchType": "standard"
- }
- ],
- "reqPermissions": [
- {
- "name":"ohos.permission.GET_BUNDLE_INFO",
- "reason":"need use ohos.permission.GET_BUNDLE_INFO"
- },
- {
- "name":"ohos.permission.UPDATE_CONFIGURATION",
- "reason":"need use ohos.permission.UPDATE_CONFIGURATION"
- }
- ],
- "js": [
- {
- "pages": [
- "pages/index/index"
- ],
- "name": "default",
- "window": {
- "designWidth": 720,
- "autoDesignWidth": false
- }
- }
- ]
- }
-}
+{
+ "app": {
+ "bundleName": "ohos.intl.test",
+ "vendor": "example",
+ "version": {
+ "code": 1,
+ "name": "1.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 5
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "ohos.intl.test",
+ "name": ".entry",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry",
+ "moduleType": "entry"
+ },
+ "abilities": [
+ {
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "orientation": "unspecified",
+ "formsEnabled": false,
+ "name": ".MainAbility",
+ "srcLanguage": "js",
+ "srcPath": "MainAbility",
+ "icon": "$media:icon",
+ "description": "$string:MainAbility_desc",
+ "label": "$string:MainAbility_label",
+ "type": "page",
+ "visible": true,
+ "launchType": "standard"
+ },
+ {
+ "orientation": "unspecified",
+ "formsEnabled": false,
+ "name": ".TestAbility",
+ "srcLanguage": "js",
+ "srcPath": "TestAbility",
+ "icon": "$media:icon",
+ "description": "$string:TestAbility_desc",
+ "label": "$string:TestAbility_label",
+ "type": "page",
+ "visible": true,
+ "launchType": "standard"
+ }
+ ],
+ "reqPermissions": [
+ {
+ "name": "ohos.permission.GET_BUNDLE_INFO",
+ "reason": "need use ohos.permission.GET_BUNDLE_INFO"
+ },
+ {
+ "name": "ohos.permission.UPDATE_CONFIGURATION",
+ "reason": "need use ohos.permission.UPDATE_CONFIGURATION"
+ }
+ ],
+ "js": [
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": "default",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
+ },
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": ".TestAbility",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
+ }
+ ],
+ "testRunner": {
+ "name": "OpenHarmonyTestRunner",
+ "srcPath": "TestRunner"
+ },
+ "mainAbility": ".MainAbility",
+ "srcPath": ""
+ }
+}
\ No newline at end of file
diff --git a/global/i18n_standard/intljs/src/main/js/default/app.js b/global/i18n_standard/intljs/src/main/js/MainAbility/app.js
old mode 100755
new mode 100644
similarity index 97%
rename from global/i18n_standard/intljs/src/main/js/default/app.js
rename to global/i18n_standard/intljs/src/main/js/MainAbility/app.js
index 044bffa75e29d7a5fe32644e19cc1bbbc5e9a7b1..9c9360f97524b0b0e7f8cc1a72e492aed920ba57
--- a/global/i18n_standard/intljs/src/main/js/default/app.js
+++ b/global/i18n_standard/intljs/src/main/js/MainAbility/app.js
@@ -1,22 +1,22 @@
-/*
- * Copyright (C) 2021 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.
- */
-export default {
- onCreate() {
- console.info('TestApplication onCreate');
- },
- onDestroy() {
- console.info('TestApplication onDestroy');
- }
-};
+/*
+ * Copyright (C) 2021 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.
+ */
+export default {
+ onCreate() {
+ console.info('TestApplication onCreate');
+ },
+ onDestroy() {
+ console.info('TestApplication onDestroy');
+ }
+};
diff --git a/global/i18n_standard/intljs/src/main/js/default/i18n/en-US.json b/global/i18n_standard/intljs/src/main/js/MainAbility/i18n/en-US.json
old mode 100755
new mode 100644
similarity index 91%
rename from global/i18n_standard/intljs/src/main/js/default/i18n/en-US.json
rename to global/i18n_standard/intljs/src/main/js/MainAbility/i18n/en-US.json
index 9ad335eebfd3e52e467b818e783e21574d79a75c..72bc8c5a8c5cce9417fd7dcf85f84f4e90c93613
--- a/global/i18n_standard/intljs/src/main/js/default/i18n/en-US.json
+++ b/global/i18n_standard/intljs/src/main/js/MainAbility/i18n/en-US.json
@@ -1,8 +1,8 @@
-{
- "strings": {
- "hello": "Global",
- "world": "System"
- },
- "Files": {
- }
+{
+ "strings": {
+ "hello": "Global",
+ "world": "System"
+ },
+ "Files": {
+ }
}
\ No newline at end of file
diff --git a/global/i18n_standard/intljs/src/main/js/default/i18n/zh-CN.json b/global/i18n_standard/intljs/src/main/js/MainAbility/i18n/zh-CN.json
old mode 100755
new mode 100644
similarity index 91%
rename from global/i18n_standard/intljs/src/main/js/default/i18n/zh-CN.json
rename to global/i18n_standard/intljs/src/main/js/MainAbility/i18n/zh-CN.json
index acf85bdacc05c91775bf8263bbbc26a08acbbfb8..45d5976ccc7bd21614946af819975529c07de152
--- a/global/i18n_standard/intljs/src/main/js/default/i18n/zh-CN.json
+++ b/global/i18n_standard/intljs/src/main/js/MainAbility/i18n/zh-CN.json
@@ -1,8 +1,8 @@
-{
- "strings": {
- "hello": "全球化",
- "world": "子系统"
- },
- "Files": {
- }
+{
+ "strings": {
+ "hello": "全球化",
+ "world": "子系统"
+ },
+ "Files": {
+ }
}
\ No newline at end of file
diff --git a/global/i18n_standard/intljs/src/main/js/default/pages/index/index.css b/global/i18n_standard/intljs/src/main/js/MainAbility/pages/index/index.css
old mode 100755
new mode 100644
similarity index 93%
rename from global/i18n_standard/intljs/src/main/js/default/pages/index/index.css
rename to global/i18n_standard/intljs/src/main/js/MainAbility/pages/index/index.css
index 6fda792753f2e15f22b529c7b90a82185b2770bf..5c52a87a04f583e9d5f4db1dd40d4eafdb9b6aeb
--- a/global/i18n_standard/intljs/src/main/js/default/pages/index/index.css
+++ b/global/i18n_standard/intljs/src/main/js/MainAbility/pages/index/index.css
@@ -1,9 +1,9 @@
-.container {
- flex-direction: column;
- justify-content: center;
- align-items: center;
-}
-
-.title {
- font-size: 100px;
-}
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
diff --git a/global/i18n_standard/intljs/src/main/js/default/pages/index/index.hml b/global/i18n_standard/intljs/src/main/js/MainAbility/pages/index/index.hml
old mode 100755
new mode 100644
similarity index 95%
rename from global/i18n_standard/intljs/src/main/js/default/pages/index/index.hml
rename to global/i18n_standard/intljs/src/main/js/MainAbility/pages/index/index.hml
index f64b040a5ae394dbaa5e185e1ecd4f4556b92184..f629c71a9be857db6cdf94149652a191b9b272ea
--- a/global/i18n_standard/intljs/src/main/js/default/pages/index/index.hml
+++ b/global/i18n_standard/intljs/src/main/js/MainAbility/pages/index/index.hml
@@ -1,5 +1,5 @@
-
-
- {{ $t('strings.hello') }} {{ title }}
-
-
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/global/i18n_standard/intljs/src/main/js/default/pages/index/index.js b/global/i18n_standard/intljs/src/main/js/MainAbility/pages/index/index.js
old mode 100755
new mode 100644
similarity index 66%
rename from global/i18n_standard/intljs/src/main/js/default/pages/index/index.js
rename to global/i18n_standard/intljs/src/main/js/MainAbility/pages/index/index.js
index 30456d5b72e14ba4918255ad8707175623a77175..6e13f07516799a59adf5300cb7a609436db8122a
--- a/global/i18n_standard/intljs/src/main/js/default/pages/index/index.js
+++ b/global/i18n_standard/intljs/src/main/js/MainAbility/pages/index/index.js
@@ -1,43 +1,29 @@
-/*
- * Copyright (C) 2021 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 {Core, ExpectExtend} from 'deccjsunit/index'
-
-export default {
- data: {
- title: ""
- },
- onInit() {
- this.title = this.$t('strings.world');
- },
- onShow() {
- console.info('onShow finish')
- const core = Core.getInstance()
- const expectExtend = new ExpectExtend({
- 'id': 'extend'
- })
- core.addService('expect', expectExtend)
- core.init()
-
- const configService = core.getDefaultService('config')
- configService.setConfig(this)
-
- require('../../test/List.test')
- core.execute()
-
- },
- onReady() {
- },
+/*
+ * Copyright (C) 2021 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.
+ */
+
+
+export default {
+ data: {
+ title: ""
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ },
+ onShow() {
+ console.info('onShow finish')
+ },
+ onReady() {
+ },
}
\ No newline at end of file
diff --git a/global/i18n_standard/intljs/src/main/js/TestAbility/app.js b/global/i18n_standard/intljs/src/main/js/TestAbility/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..cdc31f3dcf031e2f6a7665d9653e53bb649e21c5
--- /dev/null
+++ b/global/i18n_standard/intljs/src/main/js/TestAbility/app.js
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2022 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
+import { Hypium } from '@ohos/hypium'
+import testsuite from '../test/List.test'
+
+export default {
+ onCreate() {
+ console.info('TestApplication onCreate')
+ var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+ var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+ console.info('start run testcase!!!')
+ Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
+ },
+ onDestroy() {
+ console.info("TestApplication onDestroy");
+ }
+};
diff --git a/global/i18n_standard/intljs/src/main/js/TestAbility/i18n/en-US.json b/global/i18n_standard/intljs/src/main/js/TestAbility/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..3cb24b374b1d919ca8eac0638f361692b603a900
--- /dev/null
+++ b/global/i18n_standard/intljs/src/main/js/TestAbility/i18n/en-US.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/global/i18n_standard/intljs/src/main/js/TestAbility/i18n/zh-CN.json b/global/i18n_standard/intljs/src/main/js/TestAbility/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..c804e32c0c3103929baca5617cdac70be11fdba1
--- /dev/null
+++ b/global/i18n_standard/intljs/src/main/js/TestAbility/i18n/zh-CN.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/global/i18n_standard/intljs/src/main/js/TestAbility/pages/index/index.css b/global/i18n_standard/intljs/src/main/js/TestAbility/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..b1bcd43387ba131cc1d30975ff7508a6f8084a4b
--- /dev/null
+++ b/global/i18n_standard/intljs/src/main/js/TestAbility/pages/index/index.css
@@ -0,0 +1,30 @@
+.container {
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ left: 0px;
+ top: 0px;
+ width: 100%;
+ height: 100%;
+}
+
+.title {
+ font-size: 60px;
+ text-align: center;
+ width: 100%;
+ height: 40%;
+ margin: 10px;
+}
+
+@media screen and (device-type: phone) and (orientation: landscape) {
+ .title {
+ font-size: 60px;
+ }
+}
+
+@media screen and (device-type: tablet) and (orientation: landscape) {
+ .title {
+ font-size: 100px;
+ }
+}
\ No newline at end of file
diff --git a/global/i18n_standard/intljs/src/main/js/TestAbility/pages/index/index.hml b/global/i18n_standard/intljs/src/main/js/TestAbility/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..f629c71a9be857db6cdf94149652a191b9b272ea
--- /dev/null
+++ b/global/i18n_standard/intljs/src/main/js/TestAbility/pages/index/index.hml
@@ -0,0 +1,5 @@
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/global/i18n_standard/intljs/src/main/js/TestAbility/pages/index/index.js b/global/i18n_standard/intljs/src/main/js/TestAbility/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..88b083a7f6b979019d6a2c5ad20b19c5fd43286b
--- /dev/null
+++ b/global/i18n_standard/intljs/src/main/js/TestAbility/pages/index/index.js
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2022 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.
+ */
+
+export default {
+ data: {
+ title: ""
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ }
+}
+
+
+
diff --git a/global/i18n_standard/intljs/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/global/i18n_standard/intljs/src/main/js/TestRunner/OpenHarmonyTestRunner.js
new file mode 100644
index 0000000000000000000000000000000000000000..c5fa8620ca77d381f20b65a903b833e6e3378c97
--- /dev/null
+++ b/global/i18n_standard/intljs/src/main/js/TestRunner/OpenHarmonyTestRunner.js
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2022 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
+
+function translateParamsToString(parameters) {
+ const keySet = new Set([
+ '-s class', '-s notClass', '-s suite', '-s itName',
+ '-s level', '-s testType', '-s size', '-s timeout',
+ '-s package', '-s dryRun'
+ ])
+ let targetParams = '';
+ for (const key in parameters) {
+ if (keySet.has(key)) {
+ targetParams += ' ' + key + ' ' + parameters[key]
+ }
+ }
+ return targetParams.trim()
+}
+
+ export default {
+ onPrepare() {
+ console.info('OpenHarmonyTestRunner OnPrepare')
+ },
+ onRun() {
+ console.log('OpenHarmonyTestRunner onRun run')
+ var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+ var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+
+ var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility'
+
+ var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
+ cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters)
+ var debug = abilityDelegatorArguments.parameters["-D"]
+ console.info('debug value : '+debug)
+ if (debug == 'true')
+ {
+ cmd += ' -D'
+ }
+ console.info('cmd : '+cmd)
+ abilityDelegator.executeShellCommand(cmd, (err, data) => {
+ console.info('executeShellCommand : err : ' + JSON.stringify(err));
+ console.info('executeShellCommand : data : ' + data.stdResult);
+ console.info('executeShellCommand : data : ' + data.exitCode);
+ })
+ }
+};
diff --git a/global/i18n_standard/intljs/src/main/js/default/test/I18n.test.js b/global/i18n_standard/intljs/src/main/js/test/I18n.test.js
old mode 100755
new mode 100644
similarity index 97%
rename from global/i18n_standard/intljs/src/main/js/default/test/I18n.test.js
rename to global/i18n_standard/intljs/src/main/js/test/I18n.test.js
index 20f3f996810bc2ae2db0073e787dce47c953f550..ca6b45e80ce97d1ce91ef5b90d34a0212cd6b7c2
--- a/global/i18n_standard/intljs/src/main/js/default/test/I18n.test.js
+++ b/global/i18n_standard/intljs/src/main/js/test/I18n.test.js
@@ -1,2115 +1,2116 @@
-/*
- * Copyright (C) 2021 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 intl from '@ohos.intl'
-import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
-
-describe('I18nTest', function () {
- console.log('*************start I18NTest*************');
-
- let hour = I18n.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.is24HourClock()
- + ' prelang: ' + I18n.getPreferredLanguageList()
- + ' syslocale: ' + I18n.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.is24HourClock()
- + ' prelang: ' + I18n.getPreferredLanguageList()
- + ' syslocale: ' + I18n.getSystemLocale());
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_0100
- * @tc.name getSystemLanguage
- * @tc.desc check the getSystemLanguage
- */
- it('i18n_test_0100', 0, function () {
- let lang = I18n.getSystemLanguage();
- console.log('i18n_test_0100 ' + lang);
- expect(lang).assertInstanceOf('String');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_0200
- * @tc.name getSystemRegion
- * @tc.desc check the getSystemRegion
- */
- it('i18n_test_0200', 0, function () {
- let region = I18n.getSystemRegion();
- console.log('i18n_test_0200 ' + region);
- expect(region).assertInstanceOf('String');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_0300
- * @tc.name getSystemLocale
- * @tc.desc check the getSystemLocale
- */
- it('i18n_test_0300', 0, function () {
- let locale = I18n.getSystemLocale();
- console.log('i18n_test_0300 ' + locale);
- expect(locale).assertInstanceOf('String');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_3800
- * @tc.name getDisplayCountry with zh-Hans-CN and en-US and true param
- * @tc.desc check the display country
- */
- it('i18n_test_3800', 0, function () {
- let value = I18n.getDisplayCountry('zh-Hans-CN', 'en-US', true);
- console.log('i18n_test_3800 ' + value);
- expect(value).assertEqual('China');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_3900
- * @tc.name getDisplayCountry with zh and en-US and true param
- * @tc.desc check the display country
- */
- it('i18n_test_3900', 0, function () {
- let value = I18n.getDisplayCountry('zh', 'en-US', true);
- console.log('i18n_test_3900 ' + value);
- expect(value).assertEqual('China');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_4000
- * @tc.name getDisplayCountry with zh-CN and en-US and true param
- * @tc.desc check the display country
- */
- it('i18n_test_4000', 0, function () {
- let value = I18n.getDisplayCountry('zh-CN', 'en-US', true);
- console.log('i18n_test_4000 ' + value);
- expect(value).assertEqual('China');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_4100
- * @tc.name getDisplayCountry with zh-Hans and en-US and true param
- * @tc.desc check the display country
- */
- it('i18n_test_4100', 0, function () {
- let value = I18n.getDisplayCountry('zh-Hans', 'en-US', true);
- console.log('i18n_test_4100 ' + value);
- expect(value).assertEqual('China');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_4200
- * @tc.name getDisplayCountry with zh-Hans-CN and en-US and false param
- * @tc.desc check the language
- */
- it('i18n_test_4200', 0, function () {
- let value = I18n.getDisplayCountry('zh-Hans-CN', 'en-US', false);
- console.log('i18n_test_4200 ' + value);
- expect(value).assertEqual('China');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_4300
- * @tc.name getDisplayCountry with zh-Hans-CN and en-US param
- * @tc.desc check the language
- */
- it('i18n_test_4300', 0, function () {
- let value = I18n.getDisplayCountry('zh-Hans-CN', 'en-US');
- console.log('i18n_test_4300 ' + value);
- expect(value).assertEqual('China');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_4400
- * @tc.name getDisplayLanguage with zh-Hans-CN and en-US and true param
- * @tc.desc check the language
- */
- it('i18n_test_4400', 0, function () {
- let value = I18n.getDisplayLanguage('zh-Hans-CN', 'en-US', true);
- console.log('i18n_test_4400 ' + value);
- expect(value).assertEqual('Simplified Chinese');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_4500
- * @tc.name getDisplayLanguage with zh-Hans-CN and en-GB and true param
- * @tc.desc check the language
- */
- it('i18n_test_4500', 0, function () {
- let value = I18n.getDisplayLanguage('zh-Hans-CN', 'en-GB', true);
- console.log('i18n_test_4500 ' + value);
- expect(value).assertEqual('Simplified Chinese');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_4600
- * @tc.name getDisplayLanguage with zh and en-US and true param
- * @tc.desc check the language
- */
- it('i18n_test_4600', 0, function () {
- let value = I18n.getDisplayLanguage('zh', 'en-US', true);
- console.log('i18n_test_4600 ' + value);
- expect(value).assertEqual('Chinese');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_4700
- * @tc.name getDisplayLanguage with zh-CN and en-US and true param
- * @tc.desc check the language
- */
- it('i18n_test_4700', 0, function () {
- let value = I18n.getDisplayLanguage('zh-CN', 'en-US', true);
- console.log('i18n_test_4700 ' + value);
- expect(value).assertEqual('Chinese');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_4800
- * @tc.name getDisplayLanguage with zh-Hans and en-US and true param
- * @tc.desc check the language
- */
- it('i18n_test_4800', 0, function () {
- let value = I18n.getDisplayLanguage('zh-Hans', 'en-US', true);
- console.log('i18n_test_4800 ' + value);
- expect(value).assertEqual('Chinese');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_4900
- * @tc.name getDisplayLanguage with zh-Hans-CN and en-US and false param
- * @tc.desc check the language
- */
- it('i18n_test_4900', 0, function () {
- let value = I18n.getDisplayLanguage('zh-Hans-CN', 'en-US', false);
- console.log('i18n_test_4900 ' + value);
- expect(value).assertEqual('Simplified Chinese');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_5000
- * @tc.name getDisplayLanguage with zh-Hans-CN and en-US param
- * @tc.desc check the language
- */
- it('i18n_test_5000', 0, function () {
- let value = I18n.getDisplayLanguage('zh-Hans-CN', 'en-US');
- console.log('i18n_test_5000 ' + value);
- expect(value).assertEqual('Simplified Chinese');
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_5100
- * @tc.name test isValidNumber interface with 13510574676 param
- * @tc.desc get the isValidNumber value
- */
- it('i18n_test_5100', 0, function () {
- console.log('i18n_test_5100 ' + 'start');
- let phonenumber = new I18n.PhoneNumberFormat('CN');
- let ran = Math.ceil(Math.random(1) * 9);
- console.log('i18n_test_5100 ' + ran);
- let valid = phonenumber.isValidNumber('1351057467' + ran);
- console.log('i18n_test_5100 ' + valid);
- expect(valid).assertEqual(true);
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_5120
- * @tc.name test isValidNumber interface with 0755-6100088X param
- * @tc.desc get the isValidNumber value
- */
- it('i18n_test_5120', 0, function () {
- console.log('i18n_test_5120 ' + 'start');
- let phonenumber = new I18n.PhoneNumberFormat('CN');
- let ran = Math.ceil(Math.random(1) * 9);
- console.log('i18n_test_5120 ' + ran);
- let valid = phonenumber.isValidNumber('0755-6100088' + ran);
- console.log('i18n_test_5120 ' + valid);
- expect(valid).assertEqual(true);
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_5140
- * @tc.name test isValidNumber interface with 110 param
- * @tc.desc get the isValidNumber value
- */
- it('i18n_test_5140', 0, function () {
- console.log('i18n_test_5140 ' + 'start');
- let phonenumber = new I18n.PhoneNumberFormat('CN');
- let valid = phonenumber.isValidNumber('110');
- console.log('i18n_test_5140 ' + valid);
- expect(valid).assertEqual(false);
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_5200
- * @tc.name test isValidNumber interface with 135 1057 4676 param
- * @tc.desc get the isValidNumber value
- */
- it('i18n_test_5200', 0, function () {
- console.log('i18n_test_5200 ' + 'start');
- let phonenumber = new I18n.PhoneNumberFormat('CN');
- let ran = Math.ceil(Math.random(1) * 9);
- console.log('i18n_test_5200 ' + ran);
- let valid = phonenumber.isValidNumber('135 1057 467' + ran);
- console.log('i18n_test_5200 ' + valid);
- expect(valid).assertEqual(true);
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_5300
- * @tc.name test isValidNumber interface with +86 135 1057 4676 param
- * @tc.desc get the isValidNumber value
- */
- it('i18n_test_5300', 0, function () {
- console.log('i18n_test_5300 ' + 'start');
- let phonenumber = new I18n.PhoneNumberFormat('CN');
- let ran = Math.ceil(Math.random(1) * 9);
- console.log('i18n_test_5300 ' + ran);
- let valid = phonenumber.isValidNumber('+86 135 1057 467' + ran);
- console.log('i18n_test_5300 ' + valid);
- expect(valid).assertEqual(true);
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_5400
- * @tc.name test isValidNumber interface with 135-1057-4676 param
- * @tc.desc get the isValidNumber value
- */
- it('i18n_test_5400', 0, function () {
- console.log('i18n_test_5400 ' + 'start');
- let phonenumber = new I18n.PhoneNumberFormat('CN');
- let ran = Math.ceil(Math.random(1) * 9);
- console.log('i18n_test_5400 ' + ran);
- let valid = phonenumber.isValidNumber('135-1057-467' + ran);
- console.log('i18n_test_5400 ' + valid);
- expect(valid).assertEqual(true);
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_5500
- * @tc.name test isValidNumber interface with tel:+86-135-1057-4676 param
- * @tc.desc get the isValidNumber value
- */
- it('i18n_test_5500', 0, function () {
- console.log('i18n_test_5500 ' + 'start');
- let phonenumber = new I18n.PhoneNumberFormat('CN');
- let ran = Math.ceil(Math.random(1) * 9);
- console.log('i18n_test_5500 ' + ran);
- let valid = phonenumber.isValidNumber('tel:+86-135-1057-467' + ran);
- console.log('i18n_test_5500 ' + valid);
- expect(valid).assertEqual(true);
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_5600
- * @tc.name test isValidNumber interface with 86-135-1057-4676 param
- * @tc.desc get the isValidNumber value
- */
- it('i18n_test_5600', 0, function () {
- console.log('i18n_test_5600 ' + 'start');
- let phonenumber = new I18n.PhoneNumberFormat('CN');
- let ran = Math.ceil(Math.random(1) * 9);
- console.log('i18n_test_5600 ' + ran);
- let valid = phonenumber.isValidNumber('86-135-1057-467' + ran);
- console.log('i18n_test_5600 ' + valid);
- expect(valid).assertEqual(true);
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_5700
- * @tc.name test isValidNumber interface with +8613510574676 param
- * @tc.desc get the isValidNumber value
- */
- it('i18n_test_5700', 0, function () {
- console.log('i18n_test_5700 ' + 'start');
- let phonenumber = new I18n.PhoneNumberFormat('CN');
- let ran = Math.ceil(Math.random(1) * 9);
- console.log('i18n_test_5700 ' + ran);
- let valid = phonenumber.isValidNumber('+861351057467' + ran);
- console.log('i18n_test_5700 ' + valid);
- expect(valid).assertEqual(true);
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_5800
- * @tc.name test isValidNumber interface with 8613510574676 param
- * @tc.desc get the isValidNumber value
- */
- it('i18n_test_5800', 0, function () {
- console.log('i18n_test_5800 ' + 'start');
- let phonenumber = new I18n.PhoneNumberFormat('CN');
- let ran = Math.ceil(Math.random(1) * 9);
- console.log('i18n_test_5800 ' + ran);
- let valid = phonenumber.isValidNumber('861351057467' + ran);
- console.log('i18n_test_5800 ' + valid);
- expect(valid).assertEqual(true);
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_5900
- * @tc.name test isValidNumber interface with 1351057467 param
- * @tc.desc get the isValidNumber value
- */
- it('i18n_test_5900', 0, function () {
- console.log('i18n_test_5900 ' + 'start');
- let phonenumber = new I18n.PhoneNumberFormat('CN');
- let ran = Math.ceil(Math.random(1) * 9);
- console.log('i18n_test_5900 ' + ran);
- let valid = phonenumber.isValidNumber('135105746' + ran);
- console.log('i18n_test_5900 ' + valid);
- expect(valid).assertEqual(false);
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_6000
- * @tc.name test isValidNumber interface with 135105746761 param
- * @tc.desc get the isValidNumber value
- */
- it('i18n_test_6000', 0, function () {
- console.log('i18n_test_6000 ' + 'start');
- let phonenumber = new I18n.PhoneNumberFormat('CN');
- let ran = Math.ceil(Math.random(1) * 9);
- console.log('i18n_test_6000 ' + ran);
- let valid = phonenumber.isValidNumber('13510574676' + ran);
- console.log('i18n_test_6000 ' + valid);
- expect(valid).assertEqual(false);
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_6100
- * @tc.name test isValidNumber interface with 1351057467a param
- * @tc.desc get the isValidNumber value
- */
- it('i18n_test_6100', 0, function () {
- console.log('i18n_test_6100 ' + 'start');
- let phonenumber = new I18n.PhoneNumberFormat('CN');
- let ran = Math.ceil(Math.random(1) * 9);
- console.log('i18n_test_6100 ' + ran);
- let valid = phonenumber.isValidNumber('135105746' + ran + 'a');
- console.log('i18n_test_6100 ' + valid);
- expect(valid).assertEqual(false);
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_6200
- * @tc.name test isValidNumber interface with 6262023379 param
- * @tc.desc get the isValidNumber value
- */
- it('i18n_test_6200', 0, function () {
- console.log('i18n_test_6200 ' + 'start');
- let phonenumber = new I18n.PhoneNumberFormat('US');
- let ran = Math.ceil(Math.random(1) * 9);
- console.log('i18n_test_6200 ' + ran);
- let valid = phonenumber.isValidNumber('626202337' + ran);
- console.log('i18n_test_6200 ' + valid);
- expect(valid).assertEqual(true);
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_6300
- * @tc.name test isValidNumber interface with 626202337 param
- * @tc.desc get the isValidNumber value
- */
- it('i18n_test_6300', 0, function () {
- console.log('i18n_test_6300 ' + 'start');
- let phonenumber = new I18n.PhoneNumberFormat('US');
- let ran = Math.ceil(Math.random(1) * 9);
- console.log('i18n_test_6300 ' + ran);
- let valid = phonenumber.isValidNumber('62620233' + ran);
- console.log('i18n_test_6300 ' + valid);
- expect(valid).assertEqual(false);
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_6400
- * @tc.name test isValidNumber interface with 62620233791 param
- * @tc.desc get the isValidNumber value
- */
- it('i18n_test_6400', 0, function () {
- console.log('i18n_test_6400 ' + 'start');
- let phonenumber = new I18n.PhoneNumberFormat('US');
- let ran = Math.ceil(Math.random(1) * 9);
- console.log('i18n_test_6400 ' + ran);
- let valid = phonenumber.isValidNumber('6262023379' + ran);
- console.log('i18n_test_6400 ' + valid);
- expect(valid).assertEqual(false);
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_6500
- * @tc.name test isValidNumber interface with 626202337a param
- * @tc.desc get the isValidNumber value
- */
- it('i18n_test_6500', 0, function () {
- console.log('i18n_test_6500 ' + 'start');
- let phonenumber = new I18n.PhoneNumberFormat('US');
- let ran = Math.ceil(Math.random(1) * 9);
- console.log('i18n_test_6500 ' + ran);
- let valid = phonenumber.isValidNumber('62620233' + ran + 'a');
- console.log('i18n_test_6500 ' + valid);
- expect(valid).assertEqual(false);
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_6600
- * @tc.name test format interface with 13510574676 param
- * @tc.desc get the isValidNumber value
- */
- it('i18n_test_6600', 0, function () {
- console.log('i18n_test_6600 ' + 'start');
- let phonenumber = new I18n.PhoneNumberFormat('CN');
- let ran = Math.ceil(Math.random(1) * 9);
- console.log('i18n_test_6600 ' + ran);
- let value = phonenumber.format('1351057467' + ran);
- console.log('i18n_test_6600 ' + value);
- expect(value).assertEqual('135 1057 467' + ran);
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_6700
- * @tc.name test format interface with 6262023379 param
- * @tc.desc get the isValidNumber value
- */
- it('i18n_test_6700', 0, function () {
- console.log('i18n_test_6700 ' + 'start');
- let phonenumber = new I18n.PhoneNumberFormat('US');
- let ran = Math.ceil(Math.random(1) * 9);
- console.log('i18n_test_6700 ' + ran);
- let value = phonenumber.format('626202337' + ran);
- console.log('i18n_test_6700 ' + value);
- expect(value).assertEqual('(626) 202-337' + ran);
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_6800
- * @tc.name test format interface with 13510574676 and NATIONAL type param
- * @tc.desc get the isValidNumber value
- */
- it('i18n_test_6800', 0, function () {
- console.log('i18n_test_6800 ' + 'start');
- let phonenumber = new I18n.PhoneNumberFormat('CN', {'type': 'NATIONAL'});
- let ran = Math.ceil(Math.random(1) * 9);
- console.log('i18n_test_6800 ' + ran);
- let value = phonenumber.format('1351057467' + ran);
- console.log('i18n_test_6800 ' + value);
- expect(value).assertEqual('135 1057 467' + ran);
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_6900
- * @tc.name test format interface with 1351057467 and NATIONAL type param
- * @tc.desc get the isValidNumber value
- */
- it('i18n_test_6900', 0, function () {
- console.log('i18n_test_6900 ' + 'start');
- let phonenumber = new I18n.PhoneNumberFormat('CN', {'type': 'NATIONAL'});
- let ran = Math.ceil(Math.random(1) * 9);
- console.log('i18n_test_6900 ' + ran);
- let value = phonenumber.format('135105746' + ran);
- console.log('i18n_test_6900 ' + value);
- expect(value).assertEqual('135105746' + ran);
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_7000
- * @tc.name test format interface with 135105746761 and NATIONAL type param
- * @tc.desc get the isValidNumber value
- */
- it('i18n_test_7000', 0, function () {
- console.log('i18n_test_7000 ' + 'start');
- let phonenumber = new I18n.PhoneNumberFormat('CN', {'type': 'NATIONAL'});
- let ran = Math.ceil(Math.random(1) * 9);
- console.log('i18n_test_7000 ' + ran);
- let value = phonenumber.format('13510574676' + ran);
- console.log('i18n_test_7000 ' + value);
- expect(value).assertEqual('013 510 574 676' + ran);
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_7100
- * @tc.name test format interface with 135 1057 4676 and NATIONAL type param
- * @tc.desc get the isValidNumber value
- */
- it('i18n_test_7100', 0, function () {
- console.log('i18n_test_7100 ' + 'start');
- let phonenumber = new I18n.PhoneNumberFormat('CN', {'type': 'NATIONAL'});
- let ran = Math.ceil(Math.random(1) * 9);
- console.log('i18n_test_7100 ' + ran);
- let value = phonenumber.format('135 1057 467' + ran);
- console.log('i18n_test_7100 ' + value);
- expect(value).assertEqual('135 1057 467' + ran);
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_7200
- * @tc.name test format interface with 13510574676 and INTERNATIONAL type param
- * @tc.desc get the isValidNumber value
- */
- it('i18n_test_7200', 0, function () {
- console.log('i18n_test_7200 ' + 'start');
- let phonenumber = new I18n.PhoneNumberFormat('CN', {'type': 'INTERNATIONAL'});
- let ran = Math.ceil(Math.random(1) * 9);
- console.log('i18n_test_7200 ' + ran);
- let value = phonenumber.format('1351057467' + ran);
- console.log('i18n_test_7200 ' + value);
- expect(value).assertEqual('+86 135 1057 467' + ran);
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_7300
- * @tc.name test format interface with 13510574676 and RFC3966 type param
- * @tc.desc get the isValidNumber value
- */
- it('i18n_test_7300', 0, function () {
- console.log('i18n_test_7300 ' + 'start');
- let phonenumber = new I18n.PhoneNumberFormat('CN', {'type': 'RFC3966'});
- let ran = Math.ceil(Math.random(1) * 9);
- console.log('i18n_test_7300 ' + ran);
- let value = phonenumber.format('1351057467' + ran);
- console.log('i18n_test_7300 ' + value);
- expect(value).assertEqual('tel:+86-135-1057-467' + ran);
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_7400
- * @tc.name test format interface with 13510574676 and E164 type param
- * @tc.desc get the isValidNumber value
- */
- it('i18n_test_7400', 0, function () {
- console.log('i18n_test_7400 ' + 'start');
- let phonenumber = new I18n.PhoneNumberFormat('CN', {'type': 'E164'});
- let ran = Math.ceil(Math.random(1) * 9);
- console.log('i18n_test_7400 ' + ran);
- let value = phonenumber.format('1351057467' + ran);
- console.log('i18n_test_7400 ' + value);
- expect(value).assertEqual('+861351057467' + ran);
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_7500
- * @tc.name test format interface with 6262023379 and NATIONAL type param
- * @tc.desc get the isValidNumber value
- */
- it('i18n_test_7500', 0, function () {
- console.log('i18n_test_7500 ' + 'start');
- let phonenumber = new I18n.PhoneNumberFormat('US', {'type': 'NATIONAL'});
- let ran = Math.ceil(Math.random(1) * 9);
- console.log('i18n_test_7500 ' + ran);
- let value = phonenumber.format('626202337' + ran);
- console.log('i18n_test_7500 ' + value);
- expect(value).assertEqual('(626) 202-337' + ran);
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_7600
- * @tc.name test format interface with 6262023379 and INTERNATIONAL type param
- * @tc.desc get the isValidNumber value
- */
- it('i18n_test_7600', 0, function () {
- console.log('i18n_test_7600 ' + 'start');
- let phonenumber = new I18n.PhoneNumberFormat('US', {'type': 'INTERNATIONAL'});
- let ran = Math.ceil(Math.random(1) * 9);
- console.log('i18n_test_7600 ' + ran);
- let value = phonenumber.format('626202337' + ran);
- console.log('i18n_test_7600 ' + value);
- expect(value).assertEqual('+1 626-202-337' + ran);
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_7700
- * @tc.name test format interface with 6262023379 and RFC3966 type param
- * @tc.desc get the isValidNumber value
- */
- it('i18n_test_7700', 0, function () {
- console.log('i18n_test_7700 ' + 'start');
- let phonenumber = new I18n.PhoneNumberFormat('US', {'type': 'RFC3966'});
- let ran = Math.ceil(Math.random(1) * 9);
- console.log('i18n_test_7700 ' + ran);
- let value = phonenumber.format('626202337' + ran);
- console.log('i18n_test_7700 ' + value);
- expect(value).assertEqual('tel:+1-626-202-337' + ran);
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_7800
- * @tc.name test format interface with 6262023379 and E164 type param
- * @tc.desc get the isValidNumber value
- */
- it('i18n_test_7800', 0, function () {
- console.log('i18n_test_7800 ' + 'start');
- let phonenumber = new I18n.PhoneNumberFormat('US', {'type': 'E164'});
- let ran = Math.ceil(Math.random(1) * 9);
- console.log('i18n_test_7800 ' + ran);
- let value = phonenumber.format('626202337' + ran);
- console.log('i18n_test_7800 ' + value);
- expect(value).assertEqual('+1626202337' + ran);
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_7810
- * @tc.name test getLocationName method with 135... num in zh-CN locale
- * @tc.desc get the getLocationName value
- */
- it('i18n_test_7810', 0, function () {
- console.log('i18n_test_7810 ' + 'start');
- let phonenumber = new I18n.PhoneNumberFormat('CN');
- let ran = Math.ceil(Math.random(1) * 9);
- console.log('i18n_test_7810 ' + ran);
- let value = phonenumber.getLocationName('1351057467' + ran, 'zh-CN');
- console.log('i18n_test_7810 ' + value);
- expect(value).assertEqual('广东省深圳市');
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_7820
- * @tc.name test getLocationName method with 135... num in en-US locale
- * @tc.desc get the getLocationName value
- */
- it('i18n_test_7820', 0, function () {
- console.log('i18n_test_7820 ' + 'start');
- let phonenumber = new I18n.PhoneNumberFormat('CN');
- let ran = Math.ceil(Math.random(1) * 9);
- console.log('i18n_test_7820 ' + ran);
- let value = phonenumber.getLocationName('+861351057467' + ran, 'en-US');
- console.log('i18n_test_7820 ' + value);
- expect(value).assertEqual('Shenzhen, Guangdong');
- let value2 = phonenumber.getLocationName('+86 1351057467' + ran, 'en-US');
- console.log('i18n_test_7820 ' + value2);
- expect(value2).assertEqual('Shenzhen, Guangdong');
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_7830
- * @tc.name test getLocationName method with 158... num in en-US locale
- * @tc.desc get the getLocationName value
- */
- it('i18n_test_7830', 0, function () {
- console.log('i18n_test_7830 ' + 'start');
- let phonenumber = new I18n.PhoneNumberFormat('CN');
- let ran = Math.ceil(Math.random(1) * 9);
- console.log('i18n_test_7830 ' + ran);
- let value1 = phonenumber.getLocationName('+861586661737' + ran, 'en-US');
- console.log('i18n_test_7830 ' + value1);
- expect(value1).assertEqual('Jinan, Shandong');
- let value2 = phonenumber.getLocationName('+86 1586661737' + ran, 'en-US');
- console.log('i18n_test_7830 ' + value2);
- expect(value2).assertEqual('Jinan, Shandong');
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_7840
- * @tc.name test getLocationName method with 027... num in zh-CN locale
- * @tc.desc get the getLocationName value
- */
- it('i18n_test_7840', 0, function () {
- console.log('i18n_test_7840 ' + 'start');
- let phonenumber = new I18n.PhoneNumberFormat('CN');
- let ran = Math.ceil(Math.random(1) * 9);
- console.log('i18n_test_7840 ' + ran);
- let value = phonenumber.getLocationName('027-5937411' + ran, 'zh-CN');
- console.log('i18n_test_7840 ' + value);
- expect(value).assertEqual('湖北省武汉市');
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_7850
- * @tc.name test getLocationName method with 0728... num in zh-CN locale
- * @tc.desc get the getLocationName value
- */
- it('i18n_test_7850', 0, function () {
- console.log('i18n_test_7850 ' + 'start');
- let phonenumber = new I18n.PhoneNumberFormat('CN');
- let ran = Math.ceil(Math.random(1) * 9);
- console.log('i18n_test_7850 ' + ran);
- let value = phonenumber.getLocationName('0728-623797' + ran, 'zh-CN');
- console.log('i18n_test_7850 ' + value);
- expect(value).assertEqual('湖北省仙桃市');
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_7860
- * @tc.name test getLocationName method with +34... num in en-US locale
- * @tc.desc get the getLocationName value
- */
- it('i18n_test_7860', 0, function () {
- console.log('i18n_test_7860 ' + 'start');
- let phonenumber = new I18n.PhoneNumberFormat('CN');
- let ran = Math.ceil(Math.random(1) * 9);
- console.log('i18n_test_7860 ' + ran);
- let value1 = phonenumber.getLocationName('+3460724205' + ran, 'en-US');
- console.log('i18n_test_7860 ' + value1);
- expect(value1).assertEqual('Spain');
- let value2 = phonenumber.getLocationName('+34 60724205' + ran, 'en-US');
- console.log('i18n_test_7860 ' + value2);
- expect(value2).assertEqual('Spain');
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_7870
- * @tc.name test getLocationName method with +39... num in en-US locale
- * @tc.desc get the getLocationName value
- */
- it('i18n_test_7870', 0, function () {
- console.log('i18n_test_7870 ' + 'start');
- let phonenumber = new I18n.PhoneNumberFormat('CN');
- let ran = Math.ceil(Math.random(1) * 9);
- console.log('i18n_test_7870 ' + ran);
- let value = phonenumber.getLocationName('+39342652441' + ran, 'en-US');
- console.log('i18n_test_7870 ' + value);
- expect(value).assertEqual('Italy');
- let value2 = phonenumber.getLocationName('+39 342652441' + ran, 'en-US');
- console.log('i18n_test_7870 ' + value2);
- expect(value2).assertEqual('Italy');
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_7880
- * @tc.name test getLocationName method with +39... num in zh-CN locale
- * @tc.desc get the getLocationName value
- */
- it('i18n_test_7880', 0, function () {
- console.log('i18n_test_7880 ' + 'start');
- let phonenumber = new I18n.PhoneNumberFormat('CN');
- let ran = Math.ceil(Math.random(1) * 9);
- console.log('i18n_test_7880 ' + ran);
- let value = phonenumber.getLocationName('+39342652441' + ran, 'zh-CN');
- console.log('i18n_test_7880 ' + value);
- expect(value).assertEqual('意大利');
- let value2 = phonenumber.getLocationName('+39 342652441' + ran, 'zh-CN');
- console.log('i18n_test_7880 ' + value2);
- expect(value2).assertEqual('意大利');
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_7890
- * @tc.name test getLocationName method with +34... num in zh-CN locale
- * @tc.desc get the getLocationName value
- */
- it('i18n_test_7890', 0, function () {
- console.log('i18n_test_7890 ' + 'start');
- let phonenumber = new I18n.PhoneNumberFormat('CN');
- let ran = Math.ceil(Math.random(1) * 9);
- console.log('i18n_test_7890 ' + ran);
- let value1 = phonenumber.getLocationName('+3460724205' + ran, 'zh-CN');
- console.log('i18n_test_7890 ' + value1);
- expect(value1).assertEqual('西班牙');
- let value2 = phonenumber.getLocationName('+34 60724205' + ran, 'zh-CN');
- console.log('i18n_test_7890 ' + value2);
- expect(value2).assertEqual('西班牙');
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_7900
- * @tc.name test isWeekend interface
- * @tc.desc get the isWeekend value
- */
- it('i18n_test_7900', 0, function () {
- console.log('i18n_test_7900 ' + 'start');
- let calendar = I18n.getCalendar('zh');
- let value = calendar.isWeekend(new Date(2021, 10, 1, 10, 0, 0, 0));
- console.log('i18n_test_7900 ' + value);
- expect(value).assertFalse();
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_7920
- * @tc.name test getCalendar interface
- * @tc.desc get the getCalendar value
- */
- it('i18n_test_7920', 0, function () {
- console.log('i18n_test_7920 ' + 'start');
- let calendar = I18n.getCalendar('ja', 'japanese');
- let name = calendar.getDisplayName('ja');
- console.log('i18n_test_7920 ' + name);
- expect(name).assertEqual('和暦');
- let timezone = calendar.getTimeZone();
- console.log('i18n_test_7920 ' + timezone);
- expect(timezone).assertContain('Time');
- let firstday = calendar.getFirstDayOfWeek();
- console.log('i18n_test_7920 ' + firstday);
- expect(firstday).assertEqual(1);
- let miniday = calendar.getMinimalDaysInFirstWeek();
- console.log('i18n_test_7920 ' + miniday);
- expect(miniday).assertEqual(1);
- let value = calendar.isWeekend(new Date(2022, 10, 1, 10, 0, 0, 0));
- console.log('i18n_test_7920 ' + value);
- expect(value).assertFalse();
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_7940
- * @tc.name test getCalendar interface with zh param
- * @tc.desc get the getCalendar value
- */
- it('i18n_test_7940', 0, function () {
- console.log('i18n_test_7940 ' + 'start');
- let calendar = I18n.getCalendar('zh', 'chinese');
- let name = calendar.getDisplayName('zh');
- console.log('i18n_test_7940 ' + name);
- expect(name).assertEqual('农历');
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_7960
- * @tc.name test getCalendar interface with zh param
- * @tc.desc get the getCalendar value
- */
- it('i18n_test_7960', 0, function () {
- console.log('i18n_test_7960 ' + 'start');
- let calendar = I18n.getCalendar('zh', 'japanese');
- let name = calendar.getDisplayName('zh');
- console.log('i18n_test_7960 ' + name);
- expect(name).assertEqual('和历');
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_8000
- * @tc.name test getDisplayName interface
- * @tc.desc get the getDisplayName value
- */
- it('i18n_test_8000', 0, function () {
- console.log('i18n_test_8000 ' + 'start');
- let calendar = I18n.getCalendar('zh');
- let value = calendar.getDisplayName('zh');
- console.log('i18n_test_8000 ' + value);
- expect(value).assertEqual('公历');
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_8020
- * @tc.name test getDisplayName interface with en param
- * @tc.desc get the getDisplayName value
- */
- it('i18n_test_8020', 0, function () {
- console.log('i18n_test_8020 ' + 'start');
- let calendar = I18n.getCalendar('zh');
- let value = calendar.getDisplayName('en');
- console.log('i18n_test_8020 ' + value);
- expect(value).assertEqual('Gregorian Calendar');
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_8100
- * @tc.name test get interface
- * @tc.desc get the get value
- */
- it('i18n_test_8100', 0, function () {
- console.log('i18n_test_8100 ' + 'start');
- let calendar = I18n.getCalendar('zh');
- let value = calendar.get('year');
- console.log('i18n_test_8100 ' + value);
- expect(value).assertLarger(0);
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_8120
- * @tc.name test get interface with month param
- * @tc.desc get the get value
- */
- it('i18n_test_8120', 0, function () {
- console.log('i18n_test_8120 ' + 'start');
- let calendar = I18n.getCalendar('zh');
- let date1 = new Date(2021, 8, 8, 8, 8, 8, 8);
- calendar.setTime(date1);
- let value = calendar.get('month');
- console.log('i18n_test_8120 ' + value);
- expect(value).assertEqual(8);
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_8140
- * @tc.name test get interface with day_of_year param
- * @tc.desc get the get value
- */
- it('i18n_test_8140', 0, function () {
- console.log('i18n_test_8140 ' + 'start');
- let calendar = I18n.getCalendar('zh');
- let value = calendar.get('day_of_year');
- console.log('i18n_test_8140 ' + value);
- expect(value).assertLarger(0);
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_8200
- * @tc.name test setMinimalDaysInFirstWeek and getMinimalDaysInFirstWeek interface
- * @tc.desc get the setMinimalDaysInFirstWeek and getMinimalDaysInFirstWeek value
- */
- it('i18n_test_8200', 0, function () {
- console.log('i18n_test_8200 ' + 'start');
- let calendar = I18n.getCalendar('zh');
- calendar.setMinimalDaysInFirstWeek(1);
- let value = calendar.getMinimalDaysInFirstWeek();
- console.log('i18n_test_8200 ' + value);
- expect(value).assertEqual(1);
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_8220
- * @tc.name test setMinimalDaysInFirstWeek with 0 param and getMinimalDaysInFirstWeek interface
- * @tc.desc get the setMinimalDaysInFirstWeek and getMinimalDaysInFirstWeek value
- */
- it('i18n_test_8220', 0, function () {
- console.log('i18n_test_8220 ' + 'start');
- let calendar = I18n.getCalendar('zh');
- calendar.setMinimalDaysInFirstWeek(0);
- let value = calendar.getMinimalDaysInFirstWeek();
- console.log('i18n_test_8220 ' + value);
- expect(value).assertEqual(1);
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_8240
- * @tc.name test setMinimalDaysInFirstWeek with 8 param and getMinimalDaysInFirstWeek interface
- * @tc.desc get the setMinimalDaysInFirstWeek and getMinimalDaysInFirstWeek value
- */
- it('i18n_test_8240', 0, function () {
- console.log('i18n_test_8240 ' + 'start');
- let calendar = I18n.getCalendar('zh');
- calendar.setMinimalDaysInFirstWeek(8);
- let value = calendar.getMinimalDaysInFirstWeek();
- console.log('i18n_test_8240 ' + value);
- expect(value).assertEqual(7);
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_8260
- * @tc.name test setMinimalDaysInFirstWeek with 7 param and getMinimalDaysInFirstWeek interface
- * @tc.desc get the setMinimalDaysInFirstWeek and getMinimalDaysInFirstWeek value
- */
- it('i18n_test_8260', 0, function () {
- console.log('i18n_test_8260 ' + 'start');
- let calendar = I18n.getCalendar('zh');
- calendar.setMinimalDaysInFirstWeek(7);
- let value = calendar.getMinimalDaysInFirstWeek();
- console.log('i18n_test_8260 ' + value);
- expect(value).assertEqual(7);
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_8300
- * @tc.name test setFirstDayOfWeek and getFirstDayOfWeek interface
- * @tc.desc get the setFirstDayOfWeek and getFirstDayOfWeek value
- */
- it('i18n_test_8300', 0, function () {
- console.log('i18n_test_8300 ' + 'start');
- let calendar = I18n.getCalendar('zh');
- calendar.setFirstDayOfWeek(1);
- let value = calendar.getFirstDayOfWeek();
- console.log('i18n_test_8300 ' + value);
- expect(value).assertEqual(1);
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_8320
- * @tc.name test setFirstDayOfWeek with 0 param and getFirstDayOfWeek interface
- * @tc.desc get the setFirstDayOfWeek and getFirstDayOfWeek value
- */
- it('i18n_test_8320', 0, function () {
- console.log('i18n_test_8320 ' + 'start');
- let calendar = I18n.getCalendar('zh');
- calendar.setFirstDayOfWeek(0);
- let value = calendar.getFirstDayOfWeek();
- console.log('i18n_test_8320 ' + value);
- expect(value).assertEqual(1);
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_8340
- * @tc.name test setFirstDayOfWeek with 7 param and getFirstDayOfWeek interface
- * @tc.desc get the setFirstDayOfWeek and getFirstDayOfWeek value
- */
- it('i18n_test_8340', 0, function () {
- console.log('i18n_test_8340 ' + 'start');
- let calendar = I18n.getCalendar('zh');
- calendar.setFirstDayOfWeek(7);
- let value = calendar.getFirstDayOfWeek();
- console.log('i18n_test_8340 ' + value);
- expect(value).assertEqual(7);
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_8360
- * @tc.name test setFirstDayOfWeek with 8 param and getFirstDayOfWeek interface
- * @tc.desc get the setFirstDayOfWeek and getFirstDayOfWeek value
- */
- it('i18n_test_8360', 0, function () {
- console.log('i18n_test_8360 ' + 'start');
- let calendar = I18n.getCalendar('zh');
- calendar.setFirstDayOfWeek(8);
- let value = calendar.getFirstDayOfWeek();
- console.log('i18n_test_8360 ' + value);
- expect(value).assertEqual(1);
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_8400
- * @tc.name test setTimeZone and getTimeZone interface
- * @tc.desc get the setTimeZone and getTimeZone value
- */
- it('i18n_test_8400', 0, function () {
- console.log('i18n_test_8400 ' + 'start');
- let calendar = I18n.getCalendar('zh');
- calendar.setTimeZone('Asia/Shanghai');
- let value = calendar.getTimeZone();
- console.log('i18n_test_8400 ' + value);
- expect(value).assertEqual('China Standard Time');
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_8420
- * @tc.name test setTimeZone with AAA param and getTimeZone interface
- * @tc.desc get the setTimeZone and getTimeZone value
- */
- it('i18n_test_8420', 0, function () {
- console.log('i18n_test_8420 ' + 'start');
- let calendar = I18n.getCalendar('zh');
- calendar.setTimeZone('AAA');
- let value = calendar.getTimeZone();
- console.log('i18n_test_8420 ' + value);
- expect(value).assertEqual('GMT');
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_8500
- * @tc.name test set interface
- * @tc.desc get the set value
- */
- it('i18n_test_8500', 0, function () {
- console.log('i18n_test_8500 ' + 'start');
- let calendar = I18n.getCalendar('zh');
- calendar.set(2021, 11, 11);
- let value = calendar.isWeekend();
- console.log('i18n_test_8500 ' + value);
- expect(value).assertTrue();
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_8520
- * @tc.name test set interface with hour,minute,second param
- * @tc.desc get the set value
- */
- it('i18n_test_8520', 0, function () {
- console.log('i18n_test_8520 ' + 'start');
- let calendar = I18n.getCalendar('zh');
- calendar.set(2021, 11, 11, 10, 10, 10);
- let value = calendar.isWeekend();
- console.log('i18n_test_8520 ' + value);
- expect(value).assertTrue();
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_8540
- * @tc.name test set interface with hour,minute param
- * @tc.desc get the set value
- */
- it('i18n_test_8540', 0, function () {
- console.log('i18n_test_8540 ' + 'start');
- let calendar = I18n.getCalendar('zh');
- calendar.set(2021, 11, 11, 10, 10);
- let value = calendar.isWeekend();
- console.log('i18n_test_8540 ' + value);
- expect(value).assertTrue();
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_8600
- * @tc.name test setTime interface with date param
- * @tc.desc get the setTime value
- */
- it('i18n_test_8600', 0, function () {
- console.log('i18n_test_8600 ' + 'start');
- let calendar = I18n.getCalendar('zh');
- //actuall month is 9
- let date1 = new Date(2021, 8, 8, 8, 8, 8, 8);
- calendar.setTime(date1);
- let value = calendar.isWeekend();
- console.log('i18n_test_8600 ' + value);
- expect(value).assertFalse();
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_8620
- * @tc.name test setTime interface with wrong month param
- * @tc.desc get the setTime value
- */
- it('i18n_test_8620', 0, function () {
- console.log('i18n_test_8620 ' + 'start');
- let calendar = I18n.getCalendar('zh');
- let date1 = new Date(2021, 18, 8, 8, 8, 8, 8);
- calendar.setTime(date1);
- let value = calendar.isWeekend();
- console.log('i18n_test_8620 ' + value);
- expect(value).assertFalse();
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_8700
- * @tc.name test setTime interface
- * @tc.desc get the setTime value
- */
- it('i18n_test_8700', 0, function () {
- console.log('i18n_test_8700 ' + 'start');
- let calendar = I18n.getCalendar('zh');
- calendar.setTime(10540800000);
- let value = calendar.isWeekend();
- console.log('i18n_test_8700 ' + value);
- expect(value).assertTrue();
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_8800
- * @tc.name test isRTL interface with zh-CN param
- * @tc.desc get the isRTL value
- */
- it('i18n_test_8800', 0, function () {
- console.log('i18n_test_8800 ' + 'start');
- let value = I18n.isRTL('zh-CN');
- console.log('i18n_test_8800 ' + value);
- expect(value).assertFalse();
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_8900
- * @tc.name test isRTL interface with en-US param
- * @tc.desc get the isRTL value
- */
- it('i18n_test_8900', 0, function () {
- console.log('i18n_test_8900 ' + 'start');
- let value = I18n.isRTL('en-US');
- console.log('i18n_test_8900 ' + value);
- expect(value).assertFalse();
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_9000
- * @tc.name test isRTL interface with ar param
- * @tc.desc get the isRTL value
- */
- it('i18n_test_9000', 0, function () {
- console.log('i18n_test_9000 ' + 'start');
- let value = I18n.isRTL('ar');
- console.log('i18n_test_9000 ' + value);
- expect(value).assertTrue();
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_9100
- * @tc.name test unitConvert interface from cup to liter unit with long style
- * @tc.desc get the unitConvert value
- */
- it('i18n_test_9100', 0, function () {
- console.log('i18n_test_9100 ' + 'start');
- let value = I18n.Util.unitConvert({unit: 'cup', measureSystem: 'US'},
- {unit: 'liter', measureSystem: 'SI'},
- 1000,
- 'en-US',
- 'long');
- console.log('i18n_test_9100 ' + value);
- expect(value).assertEqual('236.588 liters');
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_9200
- * @tc.name test unitConvert interface from cup to liter unit with medium style
- * @tc.desc get the unitConvert value
- */
- it('i18n_test_9200', 0, function () {
- console.log('i18n_test_9200 ' + 'start');
- let value = I18n.Util.unitConvert({unit: 'cup', measureSystem: 'US'},
- {unit: 'liter', measureSystem: 'SI'},
- 1000,
- 'en-US',
- 'medium');
- console.log('i18n_test_9200 ' + value);
- expect(value).assertEqual('236.588 L');
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_9250
- * @tc.name test unitConvert interface from cup to liter unit with narrow style
- * @tc.desc get the unitConvert value
- */
- it('i18n_test_9250', 0, function () {
- console.log('i18n_test_9250 ' + 'start');
- let value = I18n.Util.unitConvert({unit: 'cup', measureSystem: 'US'},
- {unit: 'liter', measureSystem: 'SI'},
- 1000,
- 'en-US',
- 'narrow');
- console.log('i18n_test_9250 ' + value);
- expect(value).assertEqual('236.588L');
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_9300
- * @tc.name test unitConvert interface from cup to liter unit with short style
- * @tc.desc get the unitConvert value
- */
- it('i18n_test_9300', 0, function () {
- console.log('i18n_test_9300 ' + 'start');
- let value = I18n.Util.unitConvert({unit: 'cup', measureSystem: 'US'},
- {unit: 'liter', measureSystem: 'SI'},
- 1000,
- 'en-US',
- 'short');
- console.log('i18n_test_9300 ' + value);
- expect(value).assertEqual('236.588 L');
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_9400
- * @tc.name test unitConvert interface from meter to mile unit
- * @tc.desc get the unitConvert value
- */
- it('i18n_test_9400', 0, function () {
- console.log('i18n_test_9400 ' + 'start');
- let value = I18n.Util.unitConvert({unit: 'meter', measureSystem: 'SI'},
- {unit: 'mile', measureSystem: 'SI'},
- 1000,
- 'zh-CN',
- 'long');
- console.log('i18n_test_9400 ' + value);
- expect(value).assertEqual('0.621英里');
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_9500
- * @tc.name test unitConvert interface from hour to second unit
- * @tc.desc get the unitConvert value
- */
- it('i18n_test_9500', 0, function () {
- console.log('i18n_test_9500 ' + 'start');
- let value = I18n.Util.unitConvert({unit: 'hour', measureSystem: 'SI'},
- {unit: 'second', measureSystem: 'SI'},
- 10,
- 'zh-CN',
- 'medium');
- console.log('i18n_test_9500 ' + value);
- expect(value).assertEqual('36,000秒');
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_9600
- * @tc.name test unitConvert interface from celsius to fahrenheit unit
- * @tc.desc get the unitConvert value
- */
- it('i18n_test_9600', 0, function () {
- console.log('i18n_test_9600 ' + 'start');
- let value = I18n.Util.unitConvert({unit: 'celsius', measureSystem: 'SI'},
- {unit: 'fahrenheit', measureSystem: 'SI'},
- 1000,
- 'zh-CN',
- 'short');
- console.log('i18n_test_9600 ' + value);
- expect(value).assertEqual('1,832°F');
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_9700
- * @tc.name test unitConvert interface from acre to hectare unit
- * @tc.desc get the unitConvert value
- */
- it('i18n_test_9700', 0, function () {
- console.log('i18n_test_9700 ' + 'start');
- let value = I18n.Util.unitConvert({unit: 'acre', measureSystem: 'SI'},
- {unit: 'hectare', measureSystem: 'SI'},
- 1000,
- 'zh-CN',
- 'long');
- console.log('i18n_test_9700 ' + value);
- expect(value).assertEqual('404.686公顷');
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_9710
- * @tc.name test unitConvert interface from acre to square-meter unit
- * @tc.desc get the unitConvert value
- */
- it('i18n_test_9710', 0, function () {
- console.log('i18n_test_9710 ' + 'start');
- let value = I18n.Util.unitConvert({unit: 'acre', measureSystem: 'SI'},
- {unit: 'square-meter', measureSystem: 'SI'},
- 1000,
- 'zh-CN',
- 'long');
- console.log('i18n_test_9710 ' + value);
- expect(value).assertEqual('4,046,856.422平方米');
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_9800
- * @tc.name test unitConvert interface from kilometer-per-hour to knot unit
- * @tc.desc get the unitConvert value
- */
- it('i18n_test_9800', 0, function () {
- console.log('i18n_test_9800 ' + 'start');
- let value = I18n.Util.unitConvert({unit: 'kilometer-per-hour', measureSystem: 'SI'},
- {unit: 'knot', measureSystem: 'SI'},
- 1000,
- 'zh-CN',
- 'long');
- console.log('i18n_test_9800 ' + value);
- expect(value).assertEqual('539.957节');
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_9850
- * @tc.name test unitConvert interface from kilometer-per-hour to meter-per-second unit
- * @tc.desc get the unitConvert value
- */
- it('i18n_test_9850', 0, function () {
- console.log('i18n_test_9850 ' + 'start');
- let value = I18n.Util.unitConvert({unit: 'kilometer-per-hour', measureSystem: 'SI'},
- {unit: 'meter-per-second', measureSystem: 'SI'},
- 1000,
- 'zh-CN',
- 'long');
- console.log('i18n_test_9850 ' + value);
- expect(value).assertEqual('每秒277.778米');
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_9900
- * @tc.name test unitConvert interface from meter to kilometer unit
- * @tc.desc get the unitConvert value
- */
- it('i18n_test_9900', 0, function () {
- console.log('i18n_test_9900 ' + 'start');
- let value = I18n.Util.unitConvert({unit: 'meter', measureSystem: 'SI'},
- {unit: 'kilometer', measureSystem: 'SI'},
- 1000,
- 'zh-CN',
- 'long');
- console.log('i18n_test_9900 ' + value);
- expect(value).assertEqual('1公里');
- })
-
- /**
- * @tc.number SUB_GLOBAL_I18N_JS_9910
- * @tc.name test unitConvert interface from meter to meter-per-second unit
- * @tc.desc get the unitConvert value
- */
- it('i18n_test_9910', 0, function () {
- console.log('i18n_test_9910 ' + 'start');
- let value = I18n.Util.unitConvert({unit: 'meter', measureSystem: 'SI'},
- {unit: 'meter-per-second', measureSystem: 'SI'},
- 1000,
- 'zh-CN',
- 'long');
- console.log('i18n_test_9910 ' + value);
- expect(value).assertEqual('1,000米');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_BREAKITERATOR_0100
- * @tc.name test current interface
- * @tc.desc check the current result
- */
- it('i18n_test_iterator_0100', 0, function () {
- console.log('i18n_test_iterator_0100 ' + 'start');
- let iterator =I18n.getLineInstance('en');
- iterator.setLineBreakText('My name is Tom.Welcome to the sky world.');
- let value = iterator.current();
- console.log('i18n_test_iterator_0100 ' + value);
- expect(value).assertEqual(0);
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_BREAKITERATOR_0200
- * @tc.name test first interface
- * @tc.desc check the first
- */
- it('i18n_test_iterator_0200', 0, function () {
- console.log('i18n_test_iterator_0200 ' + 'start');
- let iterator =I18n.getLineInstance('en');
- iterator.setLineBreakText('My name is Tom.Welcome to the sky world.');
- let value = iterator.first();
- console.log('i18n_test_iterator_0200 ' + value);
- expect(value).assertEqual(0);
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_BREAKITERATOR_0300
- * @tc.name test last interface
- * @tc.desc check the last interface
- */
- it('i18n_test_iterator_0300', 0, function () {
- console.log('i18n_test_iterator_0300 ' + 'start');
- let iterator =I18n.getLineInstance('en');
- iterator.setLineBreakText('My name is Tom.Welcome to the sky world.');
- let value = iterator.last();
- console.log('i18n_test_iterator_0300 ' + value);
- expect(value).assertEqual(40);
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_BREAKITERATOR_0400
- * @tc.name test next interface
- * @tc.desc check the next interface
- */
- it('i18n_test_iterator_0400', 0, function () {
- console.log('i18n_test_iterator_0400 ' + 'start');
- let iterator =I18n.getLineInstance('en');
- iterator.setLineBreakText('My name is Tom.Welcome to the sky world.');
- let value = iterator.next();
- console.log('i18n_test_iterator_0400 ' + value);
- expect(value).assertEqual(3);
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_BREAKITERATOR_0500
- * @tc.name test next interface with param
- * @tc.desc check the next interface with param
- */
- it('i18n_test_iterator_0500', 0, function () {
- console.log('i18n_test_iterator_0500 ' + 'start');
- let iterator =I18n.getLineInstance('en');
- iterator.setLineBreakText('My name is Tom.Welcome to the sky world.');
- let value = iterator.next(2);
- console.log('i18n_test_iterator_0500 ' + value);
- expect(value).assertEqual(8);
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_BREAKITERATOR_0600
- * @tc.name test previous interface
- * @tc.desc check the previous interface
- */
- it('i18n_test_iterator_0600', 0, function () {
- console.log('i18n_test_iterator_0600 ' + 'start');
- let iterator =I18n.getLineInstance('en');
- iterator.setLineBreakText('My name is Tom.Welcome to the sky world.');
- let value = iterator.previous();
- console.log('i18n_test_iterator_0600 ' + value);
- expect(value).assertEqual(-1);
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_BREAKITERATOR_0700
- * @tc.name test following interface
- * @tc.desc check the following interface
- */
- it('i18n_test_iterator_0700', 0, function () {
- console.log('i18n_test_iterator_0700 ' + 'start');
- let iterator =I18n.getLineInstance('en');
- iterator.setLineBreakText('My name is Tom.Welcome to the sky world.');
- let value = iterator.following(1);
- console.log('i18n_test_iterator_0700 ' + value);
- expect(value).assertEqual(3);
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_BREAKITERATOR_0800
- * @tc.name test getLineBreakText interface
- * @tc.desc check the getLineBreakText interface
- */
- it('i18n_test_iterator_0800', 0, function () {
- console.log('i18n_test_iterator_0800 ' + 'start');
- let iterator =I18n.getLineInstance('en');
- iterator.setLineBreakText('My name is Tom.Welcome to the sky world.');
- let value = iterator.getLineBreakText();
- console.log('i18n_test_iterator_0800 ' + value);
- expect(value).assertEqual('My name is Tom.Welcome to the sky world.');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_BREAKITERATOR_0900
- * @tc.name test isBoundary interface
- * @tc.desc check the isBoundary interface
- */
- it('i18n_test_iterator_0900', 0, function () {
- console.log('i18n_test_iterator_0900 ' + 'start');
- let iterator =I18n.getLineInstance('en');
- iterator.setLineBreakText('My name is Tom.Welcome to the sky world.');
- let value = iterator.isBoundary(10);
- console.log('i18n_test_iterator_0900 ' + value);
- expect(value).assertFalse();
- // current
- let current = iterator.current();
- console.log('i18n_test_iterator_0900 ' + current);
- expect(current).assertEqual(11);
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_BREAKITERATOR_1000
- * @tc.name test iterator interface
- * @tc.desc check the iterator interface
- */
- it('i18n_test_iterator_1000', 0, function () {
- console.log('i18n_test_iterator_1000 ' + 'start');
- let iterator =I18n.getLineInstance('en');
- iterator.setLineBreakText('My name is Tom.Welcome to the sky world.');
- // current
- let current = iterator.current();
- console.log('i18n_test_iterator_1000 ' + current);
- expect(current).assertEqual(0);
- // next
- let next = iterator.next();
- console.log('i18n_test_iterator_1000 ' + next);
- expect(next).assertEqual(3);
- // current
- let current2 = iterator.current();
- console.log('i18n_test_iterator_1000 ' + current2);
- expect(current2).assertEqual(3);
- // next 5
- let next2 = iterator.next(5);
- console.log('i18n_test_iterator_1000 ' + next2);
- expect(next2).assertEqual(30);
- // previous
- let previous = iterator.previous();
- console.log('i18n_test_iterator_1000 ' + previous);
- expect(previous).assertEqual(26);
- // following 2
- let follwoing = iterator.following(3);
- console.log('i18n_test_iterator_1000 ' + follwoing);
- expect(follwoing).assertEqual(8);
- // current
- let current3 = iterator.current();
- console.log('i18n_test_iterator_1000 ' + current3);
- expect(current3).assertEqual(8);
- // isBoundary
- let value = iterator.isBoundary(3);
- console.log('i18n_test_iterator_1000 ' + value);
- expect(value).assertTrue();
- // current
- let current4 = iterator.current();
- console.log('i18n_test_iterator_1000 ' + current4);
- expect(current4).assertEqual(3);
-
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_INDEXUTIL_0100
- * @tc.name test getIndex interface
- * @tc.desc check the getIndex interface
- */
- it('i18n_test_indexutil_0100', 0, function () {
- console.log('i18n_test_indexutil_0100 ' + 'start');
- let index = I18n.getInstance();
- let value = index.getIndex('a');
- console.log('i18n_test_indexutil_0100 ' + value);
- expect(value).assertEqual('A');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_INDEXUTIL_0200
- * @tc.name test getIndexList interface
- * @tc.desc check the getIndexList interface
- */
- it('i18n_test_indexutil_0200', 0, function () {
- console.log('i18n_test_indexutil_0200 ' + 'start');
- let index = I18n.getInstance();
- let value = index.getIndexList();
- let len = value.length;
- console.log('i18n_test_indexutil_0200 ' + value);
- expect(len).assertLarger(0);
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_INDEXUTIL_0300
- * @tc.name test addLocale interface
- * @tc.desc check the addLocale interface
- */
- it('i18n_test_indexutil_0300', 0, function () {
- console.log('i18n_test_indexutil_0300 ' + 'start');
- let index = I18n.getInstance();
- index.addLocale('en');
- let value = index.getIndex('a');
- console.log('i18n_test_indexutil_0300 ' + value);
- expect(value).assertEqual('A');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_INDEXUTIL_0400
- * @tc.name test getInstance interface with zh locale
- * @tc.desc check the getInstance interface with zh locale
- */
- it('i18n_test_indexutil_0400', 0, function () {
- console.log('i18n_test_indexutil_0400 ' + 'start');
- let index = I18n.getInstance('zh');
- let value = index.getIndex('z');
- console.log('i18n_test_indexutil_0400 ' + value);
- expect(value).assertEqual('Z');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0100
- * @tc.name test isDigit interface
- * @tc.desc check the isDigit interface
- */
- it('i18n_test_character_0100', 0, function () {
- console.log('i18n_test_character_0100 ' + 'start');
- let value = I18n.Character.isDigit('abc');
- console.log('i18n_test_character_0100 ' + value);
- expect(value).assertFalse();
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0120
- * @tc.name test isDigit interface with 123 param
- * @tc.desc check the isDigit interface
- */
- it('i18n_test_character_0120', 0, function () {
- console.log('i18n_test_character_0120 ' + 'start');
- let value = I18n.Character.isDigit('123');
- console.log('i18n_test_character_0120 ' + value);
- expect(value).assertTrue();
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0140
- * @tc.name test isDigit interface with 123abc param
- * @tc.desc check the isDigit interface
- */
- it('i18n_test_character_0140', 0, function () {
- console.log('i18n_test_character_0140 ' + 'start');
- let value = I18n.Character.isDigit('123abc');
- console.log('i18n_test_character_0140 ' + value);
- expect(value).assertTrue();
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0150
- * @tc.name test isDigit interface with abc123 param
- * @tc.desc check the isDigit interface
- */
- it('i18n_test_character_0150', 0, function () {
- console.log('i18n_test_character_0150 ' + 'start');
- let value = I18n.Character.isDigit('abc123');
- console.log('i18n_test_character_0150 ' + value);
- expect(value).assertFalse();
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0160
- * @tc.name test isDigit interface with null param
- * @tc.desc check the isDigit interface
- */
- it('i18n_test_character_0160', 0, function () {
- console.log('i18n_test_character_0160 ' + 'start');
- let value = I18n.Character.isDigit('');
- console.log('i18n_test_character_0160 ' + value);
- expect(value).assertFalse();
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0200
- * @tc.name test isSpaceChar interface with abc param
- * @tc.desc check the isSpaceChar interface
- */
- it('i18n_test_character_0200', 0, function () {
- console.log('i18n_test_character_0200 ' + 'start');
- let value = I18n.Character.isSpaceChar('abc');
- console.log('i18n_test_character_0200 ' + value);
- expect(value).assertFalse();
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0220
- * @tc.name test isSpaceChar interface with one space param
- * @tc.desc check the isSpaceChar interface
- */
- it('i18n_test_character_0220', 0, function () {
- console.log('i18n_test_character_0220 ' + 'start');
- let value = I18n.Character.isSpaceChar(' ');
- console.log('i18n_test_character_0220 ' + value);
- expect(value).assertTrue();
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0240
- * @tc.name test isSpaceChar interface with multi space param
- * @tc.desc check the isSpaceChar interface
- */
- it('i18n_test_character_0240', 0, function () {
- console.log('i18n_test_character_0240 ' + 'start');
- let value = I18n.Character.isSpaceChar(' ');
- console.log('i18n_test_character_0240--' + value + '--');
- expect(value).assertTrue();
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0300
- * @tc.name test isWhitespace interface with abc param
- * @tc.desc check the isWhitespace interface
- */
- it('i18n_test_character_0300', 0, function () {
- console.log('i18n_test_character_0300 ' + 'start');
- let value = I18n.Character.isWhitespace('abc');
- console.log('i18n_test_character_0300 ' + value);
- expect(value).assertFalse();
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0320
- * @tc.name test isWhitespace interface with \u0009 param
- * @tc.desc check the isWhitespace interface
- */
- it('i18n_test_character_0320', 0, function () {
- console.log('i18n_test_character_0320 ' + 'start');
- let value = I18n.Character.isWhitespace('\u0009');
- console.log('i18n_test_character_0320--' + value + '--');
- expect(value).assertTrue();
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0400
- * @tc.name test isRTL interface with abc param
- * @tc.desc check the isRTL interface
- */
- it('i18n_test_character_0400', 0, function () {
- console.log('i18n_test_character_0400 ' + 'start');
- let value = I18n.Character.isRTL('abc');
- console.log('i18n_test_character_0400 ' + value);
- expect(value).assertFalse();
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0420
- * @tc.name test isRTL interface with ١٢٣٤٥٦٧ param
- * @tc.desc check the isRTL interface
- */
- it('i18n_test_character_0420', 0, function () {
- console.log('i18n_test_character_0420 ' + 'start');
- let value = I18n.Character.isRTL('١٢٣٤٥٦٧');
- console.log('i18n_test_character_0420 ' + value);
- expect(value).assertFalse();
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0440
- * @tc.name test isRTL interface with 我是小明 param
- * @tc.desc check the isRTL interface
- */
- it('i18n_test_character_0440', 0, function () {
- console.log('i18n_test_character_0440 ' + 'start');
- let value = I18n.Character.isRTL('我是小明');
- console.log('i18n_test_character_0440 ' + value);
- expect(value).assertFalse();
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0460
- * @tc.name test isRTL interface with نحن param
- * @tc.desc check the isRTL interface
- */
- it('i18n_test_character_0460', 0, function () {
- console.log('i18n_test_character_0460 ' + 'start');
- let value = I18n.Character.isRTL('نحن');
- console.log('i18n_test_character_0460 ' + value);
- expect(value).assertTrue();
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0500
- * @tc.name test isIdeograph interface with abc param
- * @tc.desc check the isIdeograph interface
- */
- it('i18n_test_character_0500', 0, function () {
- console.log('i18n_test_character_0500 ' + 'start');
- let value = I18n.Character.isIdeograph('abc');
- console.log('i18n_test_character_0500 ' + value);
- expect(value).assertFalse();
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0520
- * @tc.name test isIdeograph interface with '我' param
- * @tc.desc check the isIdeograph interface
- */
- it('i18n_test_character_0520', 0, function () {
- console.log('i18n_test_character_0520 ' + 'start');
- let value = I18n.Character.isIdeograph('我');
- console.log('i18n_test_character_0520 ' + value);
- expect(value).assertTrue();
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0540
- * @tc.name test isIdeograph interface with '우리' param
- * @tc.desc check the isIdeograph interface
- */
- it('i18n_test_character_0540', 0, function () {
- console.log('i18n_test_character_0540 ' + 'start');
- let value = I18n.Character.isIdeograph('우리');
- console.log('i18n_test_character_0540 ' + value);
- expect(value).assertFalse();
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0560
- * @tc.name test isIdeograph interface with '私た' param
- * @tc.desc check the isIdeograph interface
- */
- it('i18n_test_character_0560', 0, function () {
- console.log('i18n_test_character_0560 ' + 'start');
- let value = I18n.Character.isIdeograph('私たち');
- console.log('i18n_test_character_0560 ' + value);
- expect(value).assertTrue();
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0600
- * @tc.name test isLetter interface with abc param
- * @tc.desc check the isLetter interface
- */
- it('i18n_test_character_0600', 0, function () {
- console.log('i18n_test_character_0600 ' + 'start');
- let value = I18n.Character.isLetter('abc');
- console.log('i18n_test_character_0600 ' + value);
- expect(value).assertTrue();
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0620
- * @tc.name test isLetter interface with 123 param
- * @tc.desc check the isLetter interface
- */
- it('i18n_test_character_0620', 0, function () {
- console.log('i18n_test_character_0620 ' + 'start');
- let value = I18n.Character.isLetter('123');
- console.log('i18n_test_character_0620 ' + value);
- expect(value).assertFalse();
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0640
- * @tc.name test isLetter interface with abc123 param
- * @tc.desc check the isLetter interface
- */
- it('i18n_test_character_0640', 0, function () {
- console.log('i18n_test_character_0640 ' + 'start');
- let value = I18n.Character.isLetter('abc123');
- console.log('i18n_test_character_0640 ' + value);
- expect(value).assertTrue();
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0660
- * @tc.name test isLetter interface with 123abc param
- * @tc.desc check the isLetter interface
- */
- it('i18n_test_character_0660', 0, function () {
- console.log('i18n_test_character_0660 ' + 'start');
- let value = I18n.Character.isLetter('123abc');
- console.log('i18n_test_character_0660 ' + value);
- expect(value).assertFalse();
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0700
- * @tc.name test isLowerCase interface with abc param
- * @tc.desc check the isLowerCase interface
- */
- it('i18n_test_character_0700', 0, function () {
- console.log('i18n_test_character_0700 ' + 'start');
- let value = I18n.Character.isLowerCase('abc');
- console.log('i18n_test_character_0700 ' + value);
- expect(value).assertTrue();
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0720
- * @tc.name ftest isLowerCase interface with ABC param
- * @tc.desc check the isLowerCase interface
- */
- it('i18n_test_character_0720', 0, function () {
- console.log('i18n_test_character_0720 ' + 'start');
- let value = I18n.Character.isLowerCase('ABC');
- console.log('i18n_test_character_0720 ' + value);
- expect(value).assertFalse();
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0740
- * @tc.name test isLowerCase interface with abcDEF param
- * @tc.desc check the isLowerCase interface
- */
- it('i18n_test_character_0740', 0, function () {
- console.log('i18n_test_character_0740 ' + 'start');
- let value = I18n.Character.isLowerCase('abcDEF');
- console.log('i18n_test_character_0740 ' + value);
- expect(value).assertTrue();
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0760
- * @tc.name test isLowerCase interface with ABCdef param
- * @tc.desc check the isLowerCase interface
- */
- it('i18n_test_character_0760', 0, function () {
- console.log('i18n_test_character_0760 ' + 'start');
- let value = I18n.Character.isLowerCase('ABCdef');
- console.log('i18n_test_character_0760 ' + value);
- expect(value).assertFalse();
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0800
- * @tc.name test isUpperCase interface with ABC param
- * @tc.desc check the isUpperCase interface
- */
- it('i18n_test_character_0800', 0, function () {
- console.log('i18n_test_character_0800 ' + 'start');
- let value = I18n.Character.isUpperCase('ABC');
- console.log('i18n_test_character_0800 ' + value);
- expect(value).assertTrue();
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0820
- * @tc.name test isUpperCase interface with abc param
- * @tc.desc check the isUpperCase interface
- */
- it('i18n_test_character_0820', 0, function () {
- console.log('i18n_test_character_0820 ' + 'start');
- let value = I18n.Character.isUpperCase('abc');
- console.log('i18n_test_character_0820 ' + value);
- expect(value).assertFalse();
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0840
- * @tc.name test isUpperCase interface with ABCdef param
- * @tc.desc check the isUpperCase interface
- */
- it('i18n_test_character_0840', 0, function () {
- console.log('i18n_test_character_0840 ' + 'start');
- let value = I18n.Character.isUpperCase('ABCdef');
- console.log('i18n_test_character_0840 ' + value);
- expect(value).assertTrue();
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0860
- * @tc.name test isUpperCase interface with abcDEF param
- * @tc.desc check the isUpperCase interface
- */
- it('i18n_test_character_0860', 0, function () {
- console.log('i18n_test_character_0860 ' + 'start');
- let value = I18n.Character.isUpperCase('abcDEF');
- console.log('i18n_test_character_0860 ' + value);
- expect(value).assertFalse();
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0900
- * @tc.name test getType interface with a param
- * @tc.desc check the getType interface
- */
- it('i18n_test_character_0900', 0, function () {
- console.log('i18n_test_character_0900 ' + 'start');
- let value = I18n.Character.getType('a');
- console.log('i18n_test_character_0900 ' + value);
- expect(value).assertEqual('U_LOWERCASE_LETTER');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0920
- * @tc.name ftest getType interface with ABC param
- * @tc.desc check the getType interface
- */
- it('i18n_test_character_0920', 0, function () {
- console.log('i18n_test_character_0920 ' + 'start');
- let value = I18n.Character.getType('ABC');
- console.log('i18n_test_character_0920 ' + value);
- expect(value).assertEqual('U_UPPERCASE_LETTER');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0940
- * @tc.name test getType interface with ABCdef param
- * @tc.desc check the getType interface
- */
- it('i18n_test_character_0940', 0, function () {
- console.log('i18n_test_character_0940 ' + 'start');
- let value = I18n.Character.getType('ABCdef');
- console.log('i18n_test_character_0940 ' + value);
- expect(value).assertEqual('U_UPPERCASE_LETTER');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0960
- * @tc.name test getType interface with 123 param
- * @tc.desc check the getType interface
- */
- it('i18n_test_character_0960', 0, function () {
- console.log('i18n_test_character_0960 ' + 'start');
- let value = I18n.Character.getType('123');
- console.log('i18n_test_character_0960 ' + value);
- expect(value).assertEqual('U_DECIMAL_DIGIT_NUMBER');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0970
- * @tc.name test getType interface with 123abc param
- * @tc.desc check the getType interface
- */
- it('i18n_test_character_0970', 0, function () {
- console.log('i18n_test_character_0970 ' + 'start');
- let value = I18n.Character.getType('123abc');
- console.log('i18n_test_character_0970 ' + value);
- expect(value).assertEqual('U_DECIMAL_DIGIT_NUMBER');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0980
- * @tc.name test getType interface with ١٢٣٤٥٦٧ param
- * @tc.desc check the getType interface
- */
- it('i18n_test_character_0980', 0, function () {
- console.log('i18n_test_character_0980 ' + 'start');
- let value = I18n.Character.getType('١٢٣٤٥٦٧');
- console.log('i18n_test_character_0980 ' + value);
- expect(value).assertEqual('U_DECIMAL_DIGIT_NUMBER');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0990
- * @tc.name test getType interface with multi space param
- * @tc.desc check the getType interface
- */
- it('i18n_test_character_0990', 0, function () {
- console.log('i18n_test_character_0990 ' + 'start');
- let value = I18n.Character.getType(' ');
- console.log('i18n_test_character_0990 ' + value);
- expect(value).assertEqual('U_SPACE_SEPARATOR');
- })
-
- console.log('*************end I18NTest*************');
-})
\ No newline at end of file
+/*
+ * Copyright (C) 2021 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 intl from '@ohos.intl'
+import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
+
+export default function I18nTest() {
+describe('I18nTest', function () {
+ console.log('*************start I18NTest*************');
+
+ let hour = I18n.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.is24HourClock()
+ + ' prelang: ' + I18n.getPreferredLanguageList()
+ + ' syslocale: ' + I18n.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.is24HourClock()
+ + ' prelang: ' + I18n.getPreferredLanguageList()
+ + ' syslocale: ' + I18n.getSystemLocale());
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_0100
+ * @tc.name getSystemLanguage
+ * @tc.desc check the getSystemLanguage
+ */
+ it('i18n_test_0100', 0, function () {
+ let lang = I18n.getSystemLanguage();
+ console.log('i18n_test_0100 ' + lang);
+ expect(lang).assertInstanceOf('String');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_0200
+ * @tc.name getSystemRegion
+ * @tc.desc check the getSystemRegion
+ */
+ it('i18n_test_0200', 0, function () {
+ let region = I18n.getSystemRegion();
+ console.log('i18n_test_0200 ' + region);
+ expect(region).assertInstanceOf('String');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_0300
+ * @tc.name getSystemLocale
+ * @tc.desc check the getSystemLocale
+ */
+ it('i18n_test_0300', 0, function () {
+ let locale = I18n.getSystemLocale();
+ console.log('i18n_test_0300 ' + locale);
+ expect(locale).assertInstanceOf('String');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_3800
+ * @tc.name getDisplayCountry with zh-Hans-CN and en-US and true param
+ * @tc.desc check the display country
+ */
+ it('i18n_test_3800', 0, function () {
+ let value = I18n.getDisplayCountry('zh-Hans-CN', 'en-US', true);
+ console.log('i18n_test_3800 ' + value);
+ expect(value).assertEqual('China');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_3900
+ * @tc.name getDisplayCountry with zh and en-US and true param
+ * @tc.desc check the display country
+ */
+ it('i18n_test_3900', 0, function () {
+ let value = I18n.getDisplayCountry('zh', 'en-US', true);
+ console.log('i18n_test_3900 ' + value);
+ expect(value).assertEqual('China');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_4000
+ * @tc.name getDisplayCountry with zh-CN and en-US and true param
+ * @tc.desc check the display country
+ */
+ it('i18n_test_4000', 0, function () {
+ let value = I18n.getDisplayCountry('zh-CN', 'en-US', true);
+ console.log('i18n_test_4000 ' + value);
+ expect(value).assertEqual('China');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_4100
+ * @tc.name getDisplayCountry with zh-Hans and en-US and true param
+ * @tc.desc check the display country
+ */
+ it('i18n_test_4100', 0, function () {
+ let value = I18n.getDisplayCountry('zh-Hans', 'en-US', true);
+ console.log('i18n_test_4100 ' + value);
+ expect(value).assertEqual('China');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_4200
+ * @tc.name getDisplayCountry with zh-Hans-CN and en-US and false param
+ * @tc.desc check the language
+ */
+ it('i18n_test_4200', 0, function () {
+ let value = I18n.getDisplayCountry('zh-Hans-CN', 'en-US', false);
+ console.log('i18n_test_4200 ' + value);
+ expect(value).assertEqual('China');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_4300
+ * @tc.name getDisplayCountry with zh-Hans-CN and en-US param
+ * @tc.desc check the language
+ */
+ it('i18n_test_4300', 0, function () {
+ let value = I18n.getDisplayCountry('zh-Hans-CN', 'en-US');
+ console.log('i18n_test_4300 ' + value);
+ expect(value).assertEqual('China');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_4400
+ * @tc.name getDisplayLanguage with zh-Hans-CN and en-US and true param
+ * @tc.desc check the language
+ */
+ it('i18n_test_4400', 0, function () {
+ let value = I18n.getDisplayLanguage('zh-Hans-CN', 'en-US', true);
+ console.log('i18n_test_4400 ' + value);
+ expect(value).assertEqual('Simplified Chinese');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_4500
+ * @tc.name getDisplayLanguage with zh-Hans-CN and en-GB and true param
+ * @tc.desc check the language
+ */
+ it('i18n_test_4500', 0, function () {
+ let value = I18n.getDisplayLanguage('zh-Hans-CN', 'en-GB', true);
+ console.log('i18n_test_4500 ' + value);
+ expect(value).assertEqual('Simplified Chinese');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_4600
+ * @tc.name getDisplayLanguage with zh and en-US and true param
+ * @tc.desc check the language
+ */
+ it('i18n_test_4600', 0, function () {
+ let value = I18n.getDisplayLanguage('zh', 'en-US', true);
+ console.log('i18n_test_4600 ' + value);
+ expect(value).assertEqual('Chinese');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_4700
+ * @tc.name getDisplayLanguage with zh-CN and en-US and true param
+ * @tc.desc check the language
+ */
+ it('i18n_test_4700', 0, function () {
+ let value = I18n.getDisplayLanguage('zh-CN', 'en-US', true);
+ console.log('i18n_test_4700 ' + value);
+ expect(value).assertEqual('Chinese');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_4800
+ * @tc.name getDisplayLanguage with zh-Hans and en-US and true param
+ * @tc.desc check the language
+ */
+ it('i18n_test_4800', 0, function () {
+ let value = I18n.getDisplayLanguage('zh-Hans', 'en-US', true);
+ console.log('i18n_test_4800 ' + value);
+ expect(value).assertEqual('Chinese');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_4900
+ * @tc.name getDisplayLanguage with zh-Hans-CN and en-US and false param
+ * @tc.desc check the language
+ */
+ it('i18n_test_4900', 0, function () {
+ let value = I18n.getDisplayLanguage('zh-Hans-CN', 'en-US', false);
+ console.log('i18n_test_4900 ' + value);
+ expect(value).assertEqual('Simplified Chinese');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_5000
+ * @tc.name getDisplayLanguage with zh-Hans-CN and en-US param
+ * @tc.desc check the language
+ */
+ it('i18n_test_5000', 0, function () {
+ let value = I18n.getDisplayLanguage('zh-Hans-CN', 'en-US');
+ console.log('i18n_test_5000 ' + value);
+ expect(value).assertEqual('Simplified Chinese');
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_5100
+ * @tc.name test isValidNumber interface with 13510574676 param
+ * @tc.desc get the isValidNumber value
+ */
+ it('i18n_test_5100', 0, function () {
+ console.log('i18n_test_5100 ' + 'start');
+ let phonenumber = new I18n.PhoneNumberFormat('CN');
+ let ran = Math.ceil(Math.random(1) * 9);
+ console.log('i18n_test_5100 ' + ran);
+ let valid = phonenumber.isValidNumber('1351057467' + ran);
+ console.log('i18n_test_5100 ' + valid);
+ expect(valid).assertEqual(true);
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_5120
+ * @tc.name test isValidNumber interface with 0755-6100088X param
+ * @tc.desc get the isValidNumber value
+ */
+ it('i18n_test_5120', 0, function () {
+ console.log('i18n_test_5120 ' + 'start');
+ let phonenumber = new I18n.PhoneNumberFormat('CN');
+ let ran = Math.ceil(Math.random(1) * 9);
+ console.log('i18n_test_5120 ' + ran);
+ let valid = phonenumber.isValidNumber('0755-6100088' + ran);
+ console.log('i18n_test_5120 ' + valid);
+ expect(valid).assertEqual(true);
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_5140
+ * @tc.name test isValidNumber interface with 110 param
+ * @tc.desc get the isValidNumber value
+ */
+ it('i18n_test_5140', 0, function () {
+ console.log('i18n_test_5140 ' + 'start');
+ let phonenumber = new I18n.PhoneNumberFormat('CN');
+ let valid = phonenumber.isValidNumber('110');
+ console.log('i18n_test_5140 ' + valid);
+ expect(valid).assertEqual(false);
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_5200
+ * @tc.name test isValidNumber interface with 135 1057 4676 param
+ * @tc.desc get the isValidNumber value
+ */
+ it('i18n_test_5200', 0, function () {
+ console.log('i18n_test_5200 ' + 'start');
+ let phonenumber = new I18n.PhoneNumberFormat('CN');
+ let ran = Math.ceil(Math.random(1) * 9);
+ console.log('i18n_test_5200 ' + ran);
+ let valid = phonenumber.isValidNumber('135 1057 467' + ran);
+ console.log('i18n_test_5200 ' + valid);
+ expect(valid).assertEqual(true);
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_5300
+ * @tc.name test isValidNumber interface with +86 135 1057 4676 param
+ * @tc.desc get the isValidNumber value
+ */
+ it('i18n_test_5300', 0, function () {
+ console.log('i18n_test_5300 ' + 'start');
+ let phonenumber = new I18n.PhoneNumberFormat('CN');
+ let ran = Math.ceil(Math.random(1) * 9);
+ console.log('i18n_test_5300 ' + ran);
+ let valid = phonenumber.isValidNumber('+86 135 1057 467' + ran);
+ console.log('i18n_test_5300 ' + valid);
+ expect(valid).assertEqual(true);
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_5400
+ * @tc.name test isValidNumber interface with 135-1057-4676 param
+ * @tc.desc get the isValidNumber value
+ */
+ it('i18n_test_5400', 0, function () {
+ console.log('i18n_test_5400 ' + 'start');
+ let phonenumber = new I18n.PhoneNumberFormat('CN');
+ let ran = Math.ceil(Math.random(1) * 9);
+ console.log('i18n_test_5400 ' + ran);
+ let valid = phonenumber.isValidNumber('135-1057-467' + ran);
+ console.log('i18n_test_5400 ' + valid);
+ expect(valid).assertEqual(true);
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_5500
+ * @tc.name test isValidNumber interface with tel:+86-135-1057-4676 param
+ * @tc.desc get the isValidNumber value
+ */
+ it('i18n_test_5500', 0, function () {
+ console.log('i18n_test_5500 ' + 'start');
+ let phonenumber = new I18n.PhoneNumberFormat('CN');
+ let ran = Math.ceil(Math.random(1) * 9);
+ console.log('i18n_test_5500 ' + ran);
+ let valid = phonenumber.isValidNumber('tel:+86-135-1057-467' + ran);
+ console.log('i18n_test_5500 ' + valid);
+ expect(valid).assertEqual(true);
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_5600
+ * @tc.name test isValidNumber interface with 86-135-1057-4676 param
+ * @tc.desc get the isValidNumber value
+ */
+ it('i18n_test_5600', 0, function () {
+ console.log('i18n_test_5600 ' + 'start');
+ let phonenumber = new I18n.PhoneNumberFormat('CN');
+ let ran = Math.ceil(Math.random(1) * 9);
+ console.log('i18n_test_5600 ' + ran);
+ let valid = phonenumber.isValidNumber('86-135-1057-467' + ran);
+ console.log('i18n_test_5600 ' + valid);
+ expect(valid).assertEqual(true);
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_5700
+ * @tc.name test isValidNumber interface with +8613510574676 param
+ * @tc.desc get the isValidNumber value
+ */
+ it('i18n_test_5700', 0, function () {
+ console.log('i18n_test_5700 ' + 'start');
+ let phonenumber = new I18n.PhoneNumberFormat('CN');
+ let ran = Math.ceil(Math.random(1) * 9);
+ console.log('i18n_test_5700 ' + ran);
+ let valid = phonenumber.isValidNumber('+861351057467' + ran);
+ console.log('i18n_test_5700 ' + valid);
+ expect(valid).assertEqual(true);
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_5800
+ * @tc.name test isValidNumber interface with 8613510574676 param
+ * @tc.desc get the isValidNumber value
+ */
+ it('i18n_test_5800', 0, function () {
+ console.log('i18n_test_5800 ' + 'start');
+ let phonenumber = new I18n.PhoneNumberFormat('CN');
+ let ran = Math.ceil(Math.random(1) * 9);
+ console.log('i18n_test_5800 ' + ran);
+ let valid = phonenumber.isValidNumber('861351057467' + ran);
+ console.log('i18n_test_5800 ' + valid);
+ expect(valid).assertEqual(true);
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_5900
+ * @tc.name test isValidNumber interface with 1351057467 param
+ * @tc.desc get the isValidNumber value
+ */
+ it('i18n_test_5900', 0, function () {
+ console.log('i18n_test_5900 ' + 'start');
+ let phonenumber = new I18n.PhoneNumberFormat('CN');
+ let ran = Math.ceil(Math.random(1) * 9);
+ console.log('i18n_test_5900 ' + ran);
+ let valid = phonenumber.isValidNumber('135105746' + ran);
+ console.log('i18n_test_5900 ' + valid);
+ expect(valid).assertEqual(false);
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_6000
+ * @tc.name test isValidNumber interface with 135105746761 param
+ * @tc.desc get the isValidNumber value
+ */
+ it('i18n_test_6000', 0, function () {
+ console.log('i18n_test_6000 ' + 'start');
+ let phonenumber = new I18n.PhoneNumberFormat('CN');
+ let ran = Math.ceil(Math.random(1) * 9);
+ console.log('i18n_test_6000 ' + ran);
+ let valid = phonenumber.isValidNumber('13510574676' + ran);
+ console.log('i18n_test_6000 ' + valid);
+ expect(valid).assertEqual(false);
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_6100
+ * @tc.name test isValidNumber interface with 1351057467a param
+ * @tc.desc get the isValidNumber value
+ */
+ it('i18n_test_6100', 0, function () {
+ console.log('i18n_test_6100 ' + 'start');
+ let phonenumber = new I18n.PhoneNumberFormat('CN');
+ let ran = Math.ceil(Math.random(1) * 9);
+ console.log('i18n_test_6100 ' + ran);
+ let valid = phonenumber.isValidNumber('135105746' + ran + 'a');
+ console.log('i18n_test_6100 ' + valid);
+ expect(valid).assertEqual(false);
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_6200
+ * @tc.name test isValidNumber interface with 6262023379 param
+ * @tc.desc get the isValidNumber value
+ */
+ it('i18n_test_6200', 0, function () {
+ console.log('i18n_test_6200 ' + 'start');
+ let phonenumber = new I18n.PhoneNumberFormat('US');
+ let ran = Math.ceil(Math.random(1) * 9);
+ console.log('i18n_test_6200 ' + ran);
+ let valid = phonenumber.isValidNumber('626202337' + ran);
+ console.log('i18n_test_6200 ' + valid);
+ expect(valid).assertEqual(true);
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_6300
+ * @tc.name test isValidNumber interface with 626202337 param
+ * @tc.desc get the isValidNumber value
+ */
+ it('i18n_test_6300', 0, function () {
+ console.log('i18n_test_6300 ' + 'start');
+ let phonenumber = new I18n.PhoneNumberFormat('US');
+ let ran = Math.ceil(Math.random(1) * 9);
+ console.log('i18n_test_6300 ' + ran);
+ let valid = phonenumber.isValidNumber('62620233' + ran);
+ console.log('i18n_test_6300 ' + valid);
+ expect(valid).assertEqual(false);
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_6400
+ * @tc.name test isValidNumber interface with 62620233791 param
+ * @tc.desc get the isValidNumber value
+ */
+ it('i18n_test_6400', 0, function () {
+ console.log('i18n_test_6400 ' + 'start');
+ let phonenumber = new I18n.PhoneNumberFormat('US');
+ let ran = Math.ceil(Math.random(1) * 9);
+ console.log('i18n_test_6400 ' + ran);
+ let valid = phonenumber.isValidNumber('6262023379' + ran);
+ console.log('i18n_test_6400 ' + valid);
+ expect(valid).assertEqual(false);
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_6500
+ * @tc.name test isValidNumber interface with 626202337a param
+ * @tc.desc get the isValidNumber value
+ */
+ it('i18n_test_6500', 0, function () {
+ console.log('i18n_test_6500 ' + 'start');
+ let phonenumber = new I18n.PhoneNumberFormat('US');
+ let ran = Math.ceil(Math.random(1) * 9);
+ console.log('i18n_test_6500 ' + ran);
+ let valid = phonenumber.isValidNumber('62620233' + ran + 'a');
+ console.log('i18n_test_6500 ' + valid);
+ expect(valid).assertEqual(false);
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_6600
+ * @tc.name test format interface with 13510574676 param
+ * @tc.desc get the isValidNumber value
+ */
+ it('i18n_test_6600', 0, function () {
+ console.log('i18n_test_6600 ' + 'start');
+ let phonenumber = new I18n.PhoneNumberFormat('CN');
+ let ran = Math.ceil(Math.random(1) * 9);
+ console.log('i18n_test_6600 ' + ran);
+ let value = phonenumber.format('1351057467' + ran);
+ console.log('i18n_test_6600 ' + value);
+ expect(value).assertEqual('135 1057 467' + ran);
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_6700
+ * @tc.name test format interface with 6262023379 param
+ * @tc.desc get the isValidNumber value
+ */
+ it('i18n_test_6700', 0, function () {
+ console.log('i18n_test_6700 ' + 'start');
+ let phonenumber = new I18n.PhoneNumberFormat('US');
+ let ran = Math.ceil(Math.random(1) * 9);
+ console.log('i18n_test_6700 ' + ran);
+ let value = phonenumber.format('626202337' + ran);
+ console.log('i18n_test_6700 ' + value);
+ expect(value).assertEqual('(626) 202-337' + ran);
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_6800
+ * @tc.name test format interface with 13510574676 and NATIONAL type param
+ * @tc.desc get the isValidNumber value
+ */
+ it('i18n_test_6800', 0, function () {
+ console.log('i18n_test_6800 ' + 'start');
+ let phonenumber = new I18n.PhoneNumberFormat('CN', {'type': 'NATIONAL'});
+ let ran = Math.ceil(Math.random(1) * 9);
+ console.log('i18n_test_6800 ' + ran);
+ let value = phonenumber.format('1351057467' + ran);
+ console.log('i18n_test_6800 ' + value);
+ expect(value).assertEqual('135 1057 467' + ran);
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_6900
+ * @tc.name test format interface with 1351057467 and NATIONAL type param
+ * @tc.desc get the isValidNumber value
+ */
+ it('i18n_test_6900', 0, function () {
+ console.log('i18n_test_6900 ' + 'start');
+ let phonenumber = new I18n.PhoneNumberFormat('CN', {'type': 'NATIONAL'});
+ let ran = Math.ceil(Math.random(1) * 9);
+ console.log('i18n_test_6900 ' + ran);
+ let value = phonenumber.format('135105746' + ran);
+ console.log('i18n_test_6900 ' + value);
+ expect(value).assertEqual('135105746' + ran);
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_7000
+ * @tc.name test format interface with 135105746761 and NATIONAL type param
+ * @tc.desc get the isValidNumber value
+ */
+ it('i18n_test_7000', 0, function () {
+ console.log('i18n_test_7000 ' + 'start');
+ let phonenumber = new I18n.PhoneNumberFormat('CN', {'type': 'NATIONAL'});
+ let ran = Math.ceil(Math.random(1) * 9);
+ console.log('i18n_test_7000 ' + ran);
+ let value = phonenumber.format('13510574676' + ran);
+ console.log('i18n_test_7000 ' + value);
+ expect(value).assertEqual('013 510 574 676' + ran);
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_7100
+ * @tc.name test format interface with 135 1057 4676 and NATIONAL type param
+ * @tc.desc get the isValidNumber value
+ */
+ it('i18n_test_7100', 0, function () {
+ console.log('i18n_test_7100 ' + 'start');
+ let phonenumber = new I18n.PhoneNumberFormat('CN', {'type': 'NATIONAL'});
+ let ran = Math.ceil(Math.random(1) * 9);
+ console.log('i18n_test_7100 ' + ran);
+ let value = phonenumber.format('135 1057 467' + ran);
+ console.log('i18n_test_7100 ' + value);
+ expect(value).assertEqual('135 1057 467' + ran);
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_7200
+ * @tc.name test format interface with 13510574676 and INTERNATIONAL type param
+ * @tc.desc get the isValidNumber value
+ */
+ it('i18n_test_7200', 0, function () {
+ console.log('i18n_test_7200 ' + 'start');
+ let phonenumber = new I18n.PhoneNumberFormat('CN', {'type': 'INTERNATIONAL'});
+ let ran = Math.ceil(Math.random(1) * 9);
+ console.log('i18n_test_7200 ' + ran);
+ let value = phonenumber.format('1351057467' + ran);
+ console.log('i18n_test_7200 ' + value);
+ expect(value).assertEqual('+86 135 1057 467' + ran);
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_7300
+ * @tc.name test format interface with 13510574676 and RFC3966 type param
+ * @tc.desc get the isValidNumber value
+ */
+ it('i18n_test_7300', 0, function () {
+ console.log('i18n_test_7300 ' + 'start');
+ let phonenumber = new I18n.PhoneNumberFormat('CN', {'type': 'RFC3966'});
+ let ran = Math.ceil(Math.random(1) * 9);
+ console.log('i18n_test_7300 ' + ran);
+ let value = phonenumber.format('1351057467' + ran);
+ console.log('i18n_test_7300 ' + value);
+ expect(value).assertEqual('tel:+86-135-1057-467' + ran);
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_7400
+ * @tc.name test format interface with 13510574676 and E164 type param
+ * @tc.desc get the isValidNumber value
+ */
+ it('i18n_test_7400', 0, function () {
+ console.log('i18n_test_7400 ' + 'start');
+ let phonenumber = new I18n.PhoneNumberFormat('CN', {'type': 'E164'});
+ let ran = Math.ceil(Math.random(1) * 9);
+ console.log('i18n_test_7400 ' + ran);
+ let value = phonenumber.format('1351057467' + ran);
+ console.log('i18n_test_7400 ' + value);
+ expect(value).assertEqual('+861351057467' + ran);
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_7500
+ * @tc.name test format interface with 6262023379 and NATIONAL type param
+ * @tc.desc get the isValidNumber value
+ */
+ it('i18n_test_7500', 0, function () {
+ console.log('i18n_test_7500 ' + 'start');
+ let phonenumber = new I18n.PhoneNumberFormat('US', {'type': 'NATIONAL'});
+ let ran = Math.ceil(Math.random(1) * 9);
+ console.log('i18n_test_7500 ' + ran);
+ let value = phonenumber.format('626202337' + ran);
+ console.log('i18n_test_7500 ' + value);
+ expect(value).assertEqual('(626) 202-337' + ran);
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_7600
+ * @tc.name test format interface with 6262023379 and INTERNATIONAL type param
+ * @tc.desc get the isValidNumber value
+ */
+ it('i18n_test_7600', 0, function () {
+ console.log('i18n_test_7600 ' + 'start');
+ let phonenumber = new I18n.PhoneNumberFormat('US', {'type': 'INTERNATIONAL'});
+ let ran = Math.ceil(Math.random(1) * 9);
+ console.log('i18n_test_7600 ' + ran);
+ let value = phonenumber.format('626202337' + ran);
+ console.log('i18n_test_7600 ' + value);
+ expect(value).assertEqual('+1 626-202-337' + ran);
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_7700
+ * @tc.name test format interface with 6262023379 and RFC3966 type param
+ * @tc.desc get the isValidNumber value
+ */
+ it('i18n_test_7700', 0, function () {
+ console.log('i18n_test_7700 ' + 'start');
+ let phonenumber = new I18n.PhoneNumberFormat('US', {'type': 'RFC3966'});
+ let ran = Math.ceil(Math.random(1) * 9);
+ console.log('i18n_test_7700 ' + ran);
+ let value = phonenumber.format('626202337' + ran);
+ console.log('i18n_test_7700 ' + value);
+ expect(value).assertEqual('tel:+1-626-202-337' + ran);
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_7800
+ * @tc.name test format interface with 6262023379 and E164 type param
+ * @tc.desc get the isValidNumber value
+ */
+ it('i18n_test_7800', 0, function () {
+ console.log('i18n_test_7800 ' + 'start');
+ let phonenumber = new I18n.PhoneNumberFormat('US', {'type': 'E164'});
+ let ran = Math.ceil(Math.random(1) * 9);
+ console.log('i18n_test_7800 ' + ran);
+ let value = phonenumber.format('626202337' + ran);
+ console.log('i18n_test_7800 ' + value);
+ expect(value).assertEqual('+1626202337' + ran);
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_7810
+ * @tc.name test getLocationName method with 135... num in zh-CN locale
+ * @tc.desc get the getLocationName value
+ */
+ it('i18n_test_7810', 0, function () {
+ console.log('i18n_test_7810 ' + 'start');
+ let phonenumber = new I18n.PhoneNumberFormat('CN');
+ let ran = Math.ceil(Math.random(1) * 9);
+ console.log('i18n_test_7810 ' + ran);
+ let value = phonenumber.getLocationName('1351057467' + ran, 'zh-CN');
+ console.log('i18n_test_7810 ' + value);
+ expect(value).assertEqual('广东省深圳市');
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_7820
+ * @tc.name test getLocationName method with 135... num in en-US locale
+ * @tc.desc get the getLocationName value
+ */
+ it('i18n_test_7820', 0, function () {
+ console.log('i18n_test_7820 ' + 'start');
+ let phonenumber = new I18n.PhoneNumberFormat('CN');
+ let ran = Math.ceil(Math.random(1) * 9);
+ console.log('i18n_test_7820 ' + ran);
+ let value = phonenumber.getLocationName('+861351057467' + ran, 'en-US');
+ console.log('i18n_test_7820 ' + value);
+ expect(value).assertEqual('Shenzhen, Guangdong');
+ let value2 = phonenumber.getLocationName('+86 1351057467' + ran, 'en-US');
+ console.log('i18n_test_7820 ' + value2);
+ expect(value2).assertEqual('Shenzhen, Guangdong');
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_7830
+ * @tc.name test getLocationName method with 158... num in en-US locale
+ * @tc.desc get the getLocationName value
+ */
+ it('i18n_test_7830', 0, function () {
+ console.log('i18n_test_7830 ' + 'start');
+ let phonenumber = new I18n.PhoneNumberFormat('CN');
+ let ran = Math.ceil(Math.random(1) * 9);
+ console.log('i18n_test_7830 ' + ran);
+ let value1 = phonenumber.getLocationName('+861586661737' + ran, 'en-US');
+ console.log('i18n_test_7830 ' + value1);
+ expect(value1).assertEqual('Jinan, Shandong');
+ let value2 = phonenumber.getLocationName('+86 1586661737' + ran, 'en-US');
+ console.log('i18n_test_7830 ' + value2);
+ expect(value2).assertEqual('Jinan, Shandong');
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_7840
+ * @tc.name test getLocationName method with 027... num in zh-CN locale
+ * @tc.desc get the getLocationName value
+ */
+ it('i18n_test_7840', 0, function () {
+ console.log('i18n_test_7840 ' + 'start');
+ let phonenumber = new I18n.PhoneNumberFormat('CN');
+ let ran = Math.ceil(Math.random(1) * 9);
+ console.log('i18n_test_7840 ' + ran);
+ let value = phonenumber.getLocationName('027-5937411' + ran, 'zh-CN');
+ console.log('i18n_test_7840 ' + value);
+ expect(value).assertEqual('湖北省武汉市');
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_7850
+ * @tc.name test getLocationName method with 0728... num in zh-CN locale
+ * @tc.desc get the getLocationName value
+ */
+ it('i18n_test_7850', 0, function () {
+ console.log('i18n_test_7850 ' + 'start');
+ let phonenumber = new I18n.PhoneNumberFormat('CN');
+ let ran = Math.ceil(Math.random(1) * 9);
+ console.log('i18n_test_7850 ' + ran);
+ let value = phonenumber.getLocationName('0728-623797' + ran, 'zh-CN');
+ console.log('i18n_test_7850 ' + value);
+ expect(value).assertEqual('湖北省仙桃市');
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_7860
+ * @tc.name test getLocationName method with +34... num in en-US locale
+ * @tc.desc get the getLocationName value
+ */
+ it('i18n_test_7860', 0, function () {
+ console.log('i18n_test_7860 ' + 'start');
+ let phonenumber = new I18n.PhoneNumberFormat('CN');
+ let ran = Math.ceil(Math.random(1) * 9);
+ console.log('i18n_test_7860 ' + ran);
+ let value1 = phonenumber.getLocationName('+3460724205' + ran, 'en-US');
+ console.log('i18n_test_7860 ' + value1);
+ expect(value1).assertEqual('Spain');
+ let value2 = phonenumber.getLocationName('+34 60724205' + ran, 'en-US');
+ console.log('i18n_test_7860 ' + value2);
+ expect(value2).assertEqual('Spain');
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_7870
+ * @tc.name test getLocationName method with +39... num in en-US locale
+ * @tc.desc get the getLocationName value
+ */
+ it('i18n_test_7870', 0, function () {
+ console.log('i18n_test_7870 ' + 'start');
+ let phonenumber = new I18n.PhoneNumberFormat('CN');
+ let ran = Math.ceil(Math.random(1) * 9);
+ console.log('i18n_test_7870 ' + ran);
+ let value = phonenumber.getLocationName('+39342652441' + ran, 'en-US');
+ console.log('i18n_test_7870 ' + value);
+ expect(value).assertEqual('Italy');
+ let value2 = phonenumber.getLocationName('+39 342652441' + ran, 'en-US');
+ console.log('i18n_test_7870 ' + value2);
+ expect(value2).assertEqual('Italy');
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_7880
+ * @tc.name test getLocationName method with +39... num in zh-CN locale
+ * @tc.desc get the getLocationName value
+ */
+ it('i18n_test_7880', 0, function () {
+ console.log('i18n_test_7880 ' + 'start');
+ let phonenumber = new I18n.PhoneNumberFormat('CN');
+ let ran = Math.ceil(Math.random(1) * 9);
+ console.log('i18n_test_7880 ' + ran);
+ let value = phonenumber.getLocationName('+39342652441' + ran, 'zh-CN');
+ console.log('i18n_test_7880 ' + value);
+ expect(value).assertEqual('意大利');
+ let value2 = phonenumber.getLocationName('+39 342652441' + ran, 'zh-CN');
+ console.log('i18n_test_7880 ' + value2);
+ expect(value2).assertEqual('意大利');
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_7890
+ * @tc.name test getLocationName method with +34... num in zh-CN locale
+ * @tc.desc get the getLocationName value
+ */
+ it('i18n_test_7890', 0, function () {
+ console.log('i18n_test_7890 ' + 'start');
+ let phonenumber = new I18n.PhoneNumberFormat('CN');
+ let ran = Math.ceil(Math.random(1) * 9);
+ console.log('i18n_test_7890 ' + ran);
+ let value1 = phonenumber.getLocationName('+3460724205' + ran, 'zh-CN');
+ console.log('i18n_test_7890 ' + value1);
+ expect(value1).assertEqual('西班牙');
+ let value2 = phonenumber.getLocationName('+34 60724205' + ran, 'zh-CN');
+ console.log('i18n_test_7890 ' + value2);
+ expect(value2).assertEqual('西班牙');
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_7900
+ * @tc.name test isWeekend interface
+ * @tc.desc get the isWeekend value
+ */
+ it('i18n_test_7900', 0, function () {
+ console.log('i18n_test_7900 ' + 'start');
+ let calendar = I18n.getCalendar('zh');
+ let value = calendar.isWeekend(new Date(2021, 10, 1, 10, 0, 0, 0));
+ console.log('i18n_test_7900 ' + value);
+ expect(value).assertFalse();
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_7920
+ * @tc.name test getCalendar interface
+ * @tc.desc get the getCalendar value
+ */
+ it('i18n_test_7920', 0, function () {
+ console.log('i18n_test_7920 ' + 'start');
+ let calendar = I18n.getCalendar('ja', 'japanese');
+ let name = calendar.getDisplayName('ja');
+ console.log('i18n_test_7920 ' + name);
+ expect(name).assertEqual('和暦');
+ let timezone = calendar.getTimeZone();
+ console.log('i18n_test_7920 ' + timezone);
+ expect(timezone).assertContain('Time');
+ let firstday = calendar.getFirstDayOfWeek();
+ console.log('i18n_test_7920 ' + firstday);
+ expect(firstday).assertEqual(1);
+ let miniday = calendar.getMinimalDaysInFirstWeek();
+ console.log('i18n_test_7920 ' + miniday);
+ expect(miniday).assertEqual(1);
+ let value = calendar.isWeekend(new Date(2022, 10, 1, 10, 0, 0, 0));
+ console.log('i18n_test_7920 ' + value);
+ expect(value).assertFalse();
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_7940
+ * @tc.name test getCalendar interface with zh param
+ * @tc.desc get the getCalendar value
+ */
+ it('i18n_test_7940', 0, function () {
+ console.log('i18n_test_7940 ' + 'start');
+ let calendar = I18n.getCalendar('zh', 'chinese');
+ let name = calendar.getDisplayName('zh');
+ console.log('i18n_test_7940 ' + name);
+ expect(name).assertEqual('农历');
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_7960
+ * @tc.name test getCalendar interface with zh param
+ * @tc.desc get the getCalendar value
+ */
+ it('i18n_test_7960', 0, function () {
+ console.log('i18n_test_7960 ' + 'start');
+ let calendar = I18n.getCalendar('zh', 'japanese');
+ let name = calendar.getDisplayName('zh');
+ console.log('i18n_test_7960 ' + name);
+ expect(name).assertEqual('和历');
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_8000
+ * @tc.name test getDisplayName interface
+ * @tc.desc get the getDisplayName value
+ */
+ it('i18n_test_8000', 0, function () {
+ console.log('i18n_test_8000 ' + 'start');
+ let calendar = I18n.getCalendar('zh');
+ let value = calendar.getDisplayName('zh');
+ console.log('i18n_test_8000 ' + value);
+ expect(value).assertEqual('公历');
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_8020
+ * @tc.name test getDisplayName interface with en param
+ * @tc.desc get the getDisplayName value
+ */
+ it('i18n_test_8020', 0, function () {
+ console.log('i18n_test_8020 ' + 'start');
+ let calendar = I18n.getCalendar('zh');
+ let value = calendar.getDisplayName('en');
+ console.log('i18n_test_8020 ' + value);
+ expect(value).assertEqual('Gregorian Calendar');
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_8100
+ * @tc.name test get interface
+ * @tc.desc get the get value
+ */
+ it('i18n_test_8100', 0, function () {
+ console.log('i18n_test_8100 ' + 'start');
+ let calendar = I18n.getCalendar('zh');
+ let value = calendar.get('year');
+ console.log('i18n_test_8100 ' + value);
+ expect(value).assertLarger(0);
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_8120
+ * @tc.name test get interface with month param
+ * @tc.desc get the get value
+ */
+ it('i18n_test_8120', 0, function () {
+ console.log('i18n_test_8120 ' + 'start');
+ let calendar = I18n.getCalendar('zh');
+ let date1 = new Date(2021, 8, 8, 8, 8, 8, 8);
+ calendar.setTime(date1);
+ let value = calendar.get('month');
+ console.log('i18n_test_8120 ' + value);
+ expect(value).assertEqual(8);
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_8140
+ * @tc.name test get interface with day_of_year param
+ * @tc.desc get the get value
+ */
+ it('i18n_test_8140', 0, function () {
+ console.log('i18n_test_8140 ' + 'start');
+ let calendar = I18n.getCalendar('zh');
+ let value = calendar.get('day_of_year');
+ console.log('i18n_test_8140 ' + value);
+ expect(value).assertLarger(0);
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_8200
+ * @tc.name test setMinimalDaysInFirstWeek and getMinimalDaysInFirstWeek interface
+ * @tc.desc get the setMinimalDaysInFirstWeek and getMinimalDaysInFirstWeek value
+ */
+ it('i18n_test_8200', 0, function () {
+ console.log('i18n_test_8200 ' + 'start');
+ let calendar = I18n.getCalendar('zh');
+ calendar.setMinimalDaysInFirstWeek(1);
+ let value = calendar.getMinimalDaysInFirstWeek();
+ console.log('i18n_test_8200 ' + value);
+ expect(value).assertEqual(1);
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_8220
+ * @tc.name test setMinimalDaysInFirstWeek with 0 param and getMinimalDaysInFirstWeek interface
+ * @tc.desc get the setMinimalDaysInFirstWeek and getMinimalDaysInFirstWeek value
+ */
+ it('i18n_test_8220', 0, function () {
+ console.log('i18n_test_8220 ' + 'start');
+ let calendar = I18n.getCalendar('zh');
+ calendar.setMinimalDaysInFirstWeek(0);
+ let value = calendar.getMinimalDaysInFirstWeek();
+ console.log('i18n_test_8220 ' + value);
+ expect(value).assertEqual(1);
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_8240
+ * @tc.name test setMinimalDaysInFirstWeek with 8 param and getMinimalDaysInFirstWeek interface
+ * @tc.desc get the setMinimalDaysInFirstWeek and getMinimalDaysInFirstWeek value
+ */
+ it('i18n_test_8240', 0, function () {
+ console.log('i18n_test_8240 ' + 'start');
+ let calendar = I18n.getCalendar('zh');
+ calendar.setMinimalDaysInFirstWeek(8);
+ let value = calendar.getMinimalDaysInFirstWeek();
+ console.log('i18n_test_8240 ' + value);
+ expect(value).assertEqual(7);
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_8260
+ * @tc.name test setMinimalDaysInFirstWeek with 7 param and getMinimalDaysInFirstWeek interface
+ * @tc.desc get the setMinimalDaysInFirstWeek and getMinimalDaysInFirstWeek value
+ */
+ it('i18n_test_8260', 0, function () {
+ console.log('i18n_test_8260 ' + 'start');
+ let calendar = I18n.getCalendar('zh');
+ calendar.setMinimalDaysInFirstWeek(7);
+ let value = calendar.getMinimalDaysInFirstWeek();
+ console.log('i18n_test_8260 ' + value);
+ expect(value).assertEqual(7);
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_8300
+ * @tc.name test setFirstDayOfWeek and getFirstDayOfWeek interface
+ * @tc.desc get the setFirstDayOfWeek and getFirstDayOfWeek value
+ */
+ it('i18n_test_8300', 0, function () {
+ console.log('i18n_test_8300 ' + 'start');
+ let calendar = I18n.getCalendar('zh');
+ calendar.setFirstDayOfWeek(1);
+ let value = calendar.getFirstDayOfWeek();
+ console.log('i18n_test_8300 ' + value);
+ expect(value).assertEqual(1);
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_8320
+ * @tc.name test setFirstDayOfWeek with 0 param and getFirstDayOfWeek interface
+ * @tc.desc get the setFirstDayOfWeek and getFirstDayOfWeek value
+ */
+ it('i18n_test_8320', 0, function () {
+ console.log('i18n_test_8320 ' + 'start');
+ let calendar = I18n.getCalendar('zh');
+ calendar.setFirstDayOfWeek(0);
+ let value = calendar.getFirstDayOfWeek();
+ console.log('i18n_test_8320 ' + value);
+ expect(value).assertEqual(1);
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_8340
+ * @tc.name test setFirstDayOfWeek with 7 param and getFirstDayOfWeek interface
+ * @tc.desc get the setFirstDayOfWeek and getFirstDayOfWeek value
+ */
+ it('i18n_test_8340', 0, function () {
+ console.log('i18n_test_8340 ' + 'start');
+ let calendar = I18n.getCalendar('zh');
+ calendar.setFirstDayOfWeek(7);
+ let value = calendar.getFirstDayOfWeek();
+ console.log('i18n_test_8340 ' + value);
+ expect(value).assertEqual(7);
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_8360
+ * @tc.name test setFirstDayOfWeek with 8 param and getFirstDayOfWeek interface
+ * @tc.desc get the setFirstDayOfWeek and getFirstDayOfWeek value
+ */
+ it('i18n_test_8360', 0, function () {
+ console.log('i18n_test_8360 ' + 'start');
+ let calendar = I18n.getCalendar('zh');
+ calendar.setFirstDayOfWeek(8);
+ let value = calendar.getFirstDayOfWeek();
+ console.log('i18n_test_8360 ' + value);
+ expect(value).assertEqual(1);
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_8400
+ * @tc.name test setTimeZone and getTimeZone interface
+ * @tc.desc get the setTimeZone and getTimeZone value
+ */
+ it('i18n_test_8400', 0, function () {
+ console.log('i18n_test_8400 ' + 'start');
+ let calendar = I18n.getCalendar('zh');
+ calendar.setTimeZone('Asia/Shanghai');
+ let value = calendar.getTimeZone();
+ console.log('i18n_test_8400 ' + value);
+ expect(value).assertEqual('China Standard Time');
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_8420
+ * @tc.name test setTimeZone with AAA param and getTimeZone interface
+ * @tc.desc get the setTimeZone and getTimeZone value
+ */
+ it('i18n_test_8420', 0, function () {
+ console.log('i18n_test_8420 ' + 'start');
+ let calendar = I18n.getCalendar('zh');
+ calendar.setTimeZone('AAA');
+ let value = calendar.getTimeZone();
+ console.log('i18n_test_8420 ' + value);
+ expect(value).assertEqual('GMT');
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_8500
+ * @tc.name test set interface
+ * @tc.desc get the set value
+ */
+ it('i18n_test_8500', 0, function () {
+ console.log('i18n_test_8500 ' + 'start');
+ let calendar = I18n.getCalendar('zh');
+ calendar.set(2021, 11, 11);
+ let value = calendar.isWeekend();
+ console.log('i18n_test_8500 ' + value);
+ expect(value).assertTrue();
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_8520
+ * @tc.name test set interface with hour,minute,second param
+ * @tc.desc get the set value
+ */
+ it('i18n_test_8520', 0, function () {
+ console.log('i18n_test_8520 ' + 'start');
+ let calendar = I18n.getCalendar('zh');
+ calendar.set(2021, 11, 11, 10, 10, 10);
+ let value = calendar.isWeekend();
+ console.log('i18n_test_8520 ' + value);
+ expect(value).assertTrue();
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_8540
+ * @tc.name test set interface with hour,minute param
+ * @tc.desc get the set value
+ */
+ it('i18n_test_8540', 0, function () {
+ console.log('i18n_test_8540 ' + 'start');
+ let calendar = I18n.getCalendar('zh');
+ calendar.set(2021, 11, 11, 10, 10);
+ let value = calendar.isWeekend();
+ console.log('i18n_test_8540 ' + value);
+ expect(value).assertTrue();
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_8600
+ * @tc.name test setTime interface with date param
+ * @tc.desc get the setTime value
+ */
+ it('i18n_test_8600', 0, function () {
+ console.log('i18n_test_8600 ' + 'start');
+ let calendar = I18n.getCalendar('zh');
+ //actuall month is 9
+ let date1 = new Date(2021, 8, 8, 8, 8, 8, 8);
+ calendar.setTime(date1);
+ let value = calendar.isWeekend();
+ console.log('i18n_test_8600 ' + value);
+ expect(value).assertFalse();
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_8620
+ * @tc.name test setTime interface with wrong month param
+ * @tc.desc get the setTime value
+ */
+ it('i18n_test_8620', 0, function () {
+ console.log('i18n_test_8620 ' + 'start');
+ let calendar = I18n.getCalendar('zh');
+ let date1 = new Date(2021, 18, 8, 8, 8, 8, 8);
+ calendar.setTime(date1);
+ let value = calendar.isWeekend();
+ console.log('i18n_test_8620 ' + value);
+ expect(value).assertFalse();
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_8700
+ * @tc.name test setTime interface
+ * @tc.desc get the setTime value
+ */
+ it('i18n_test_8700', 0, function () {
+ console.log('i18n_test_8700 ' + 'start');
+ let calendar = I18n.getCalendar('zh');
+ calendar.setTime(10540800000);
+ let value = calendar.isWeekend();
+ console.log('i18n_test_8700 ' + value);
+ expect(value).assertTrue();
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_8800
+ * @tc.name test isRTL interface with zh-CN param
+ * @tc.desc get the isRTL value
+ */
+ it('i18n_test_8800', 0, function () {
+ console.log('i18n_test_8800 ' + 'start');
+ let value = I18n.isRTL('zh-CN');
+ console.log('i18n_test_8800 ' + value);
+ expect(value).assertFalse();
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_8900
+ * @tc.name test isRTL interface with en-US param
+ * @tc.desc get the isRTL value
+ */
+ it('i18n_test_8900', 0, function () {
+ console.log('i18n_test_8900 ' + 'start');
+ let value = I18n.isRTL('en-US');
+ console.log('i18n_test_8900 ' + value);
+ expect(value).assertFalse();
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_9000
+ * @tc.name test isRTL interface with ar param
+ * @tc.desc get the isRTL value
+ */
+ it('i18n_test_9000', 0, function () {
+ console.log('i18n_test_9000 ' + 'start');
+ let value = I18n.isRTL('ar');
+ console.log('i18n_test_9000 ' + value);
+ expect(value).assertTrue();
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_9100
+ * @tc.name test unitConvert interface from cup to liter unit with long style
+ * @tc.desc get the unitConvert value
+ */
+ it('i18n_test_9100', 0, function () {
+ console.log('i18n_test_9100 ' + 'start');
+ let value = I18n.Util.unitConvert({unit: 'cup', measureSystem: 'US'},
+ {unit: 'liter', measureSystem: 'SI'},
+ 1000,
+ 'en-US',
+ 'long');
+ console.log('i18n_test_9100 ' + value);
+ expect(value).assertEqual('236.588 liters');
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_9200
+ * @tc.name test unitConvert interface from cup to liter unit with medium style
+ * @tc.desc get the unitConvert value
+ */
+ it('i18n_test_9200', 0, function () {
+ console.log('i18n_test_9200 ' + 'start');
+ let value = I18n.Util.unitConvert({unit: 'cup', measureSystem: 'US'},
+ {unit: 'liter', measureSystem: 'SI'},
+ 1000,
+ 'en-US',
+ 'medium');
+ console.log('i18n_test_9200 ' + value);
+ expect(value).assertEqual('236.588 L');
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_9250
+ * @tc.name test unitConvert interface from cup to liter unit with narrow style
+ * @tc.desc get the unitConvert value
+ */
+ it('i18n_test_9250', 0, function () {
+ console.log('i18n_test_9250 ' + 'start');
+ let value = I18n.Util.unitConvert({unit: 'cup', measureSystem: 'US'},
+ {unit: 'liter', measureSystem: 'SI'},
+ 1000,
+ 'en-US',
+ 'narrow');
+ console.log('i18n_test_9250 ' + value);
+ expect(value).assertEqual('236.588L');
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_9300
+ * @tc.name test unitConvert interface from cup to liter unit with short style
+ * @tc.desc get the unitConvert value
+ */
+ it('i18n_test_9300', 0, function () {
+ console.log('i18n_test_9300 ' + 'start');
+ let value = I18n.Util.unitConvert({unit: 'cup', measureSystem: 'US'},
+ {unit: 'liter', measureSystem: 'SI'},
+ 1000,
+ 'en-US',
+ 'short');
+ console.log('i18n_test_9300 ' + value);
+ expect(value).assertEqual('236.588 L');
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_9400
+ * @tc.name test unitConvert interface from meter to mile unit
+ * @tc.desc get the unitConvert value
+ */
+ it('i18n_test_9400', 0, function () {
+ console.log('i18n_test_9400 ' + 'start');
+ let value = I18n.Util.unitConvert({unit: 'meter', measureSystem: 'SI'},
+ {unit: 'mile', measureSystem: 'SI'},
+ 1000,
+ 'zh-CN',
+ 'long');
+ console.log('i18n_test_9400 ' + value);
+ expect(value).assertEqual('0.621英里');
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_9500
+ * @tc.name test unitConvert interface from hour to second unit
+ * @tc.desc get the unitConvert value
+ */
+ it('i18n_test_9500', 0, function () {
+ console.log('i18n_test_9500 ' + 'start');
+ let value = I18n.Util.unitConvert({unit: 'hour', measureSystem: 'SI'},
+ {unit: 'second', measureSystem: 'SI'},
+ 10,
+ 'zh-CN',
+ 'medium');
+ console.log('i18n_test_9500 ' + value);
+ expect(value).assertEqual('36,000秒');
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_9600
+ * @tc.name test unitConvert interface from celsius to fahrenheit unit
+ * @tc.desc get the unitConvert value
+ */
+ it('i18n_test_9600', 0, function () {
+ console.log('i18n_test_9600 ' + 'start');
+ let value = I18n.Util.unitConvert({unit: 'celsius', measureSystem: 'SI'},
+ {unit: 'fahrenheit', measureSystem: 'SI'},
+ 1000,
+ 'zh-CN',
+ 'short');
+ console.log('i18n_test_9600 ' + value);
+ expect(value).assertEqual('1,832°F');
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_9700
+ * @tc.name test unitConvert interface from acre to hectare unit
+ * @tc.desc get the unitConvert value
+ */
+ it('i18n_test_9700', 0, function () {
+ console.log('i18n_test_9700 ' + 'start');
+ let value = I18n.Util.unitConvert({unit: 'acre', measureSystem: 'SI'},
+ {unit: 'hectare', measureSystem: 'SI'},
+ 1000,
+ 'zh-CN',
+ 'long');
+ console.log('i18n_test_9700 ' + value);
+ expect(value).assertEqual('404.686公顷');
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_9710
+ * @tc.name test unitConvert interface from acre to square-meter unit
+ * @tc.desc get the unitConvert value
+ */
+ it('i18n_test_9710', 0, function () {
+ console.log('i18n_test_9710 ' + 'start');
+ let value = I18n.Util.unitConvert({unit: 'acre', measureSystem: 'SI'},
+ {unit: 'square-meter', measureSystem: 'SI'},
+ 1000,
+ 'zh-CN',
+ 'long');
+ console.log('i18n_test_9710 ' + value);
+ expect(value).assertEqual('4,046,856.422平方米');
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_9800
+ * @tc.name test unitConvert interface from kilometer-per-hour to knot unit
+ * @tc.desc get the unitConvert value
+ */
+ it('i18n_test_9800', 0, function () {
+ console.log('i18n_test_9800 ' + 'start');
+ let value = I18n.Util.unitConvert({unit: 'kilometer-per-hour', measureSystem: 'SI'},
+ {unit: 'knot', measureSystem: 'SI'},
+ 1000,
+ 'zh-CN',
+ 'long');
+ console.log('i18n_test_9800 ' + value);
+ expect(value).assertEqual('539.957节');
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_9850
+ * @tc.name test unitConvert interface from kilometer-per-hour to meter-per-second unit
+ * @tc.desc get the unitConvert value
+ */
+ it('i18n_test_9850', 0, function () {
+ console.log('i18n_test_9850 ' + 'start');
+ let value = I18n.Util.unitConvert({unit: 'kilometer-per-hour', measureSystem: 'SI'},
+ {unit: 'meter-per-second', measureSystem: 'SI'},
+ 1000,
+ 'zh-CN',
+ 'long');
+ console.log('i18n_test_9850 ' + value);
+ expect(value).assertEqual('每秒277.778米');
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_9900
+ * @tc.name test unitConvert interface from meter to kilometer unit
+ * @tc.desc get the unitConvert value
+ */
+ it('i18n_test_9900', 0, function () {
+ console.log('i18n_test_9900 ' + 'start');
+ let value = I18n.Util.unitConvert({unit: 'meter', measureSystem: 'SI'},
+ {unit: 'kilometer', measureSystem: 'SI'},
+ 1000,
+ 'zh-CN',
+ 'long');
+ console.log('i18n_test_9900 ' + value);
+ expect(value).assertEqual('1公里');
+ })
+
+ /**
+ * @tc.number SUB_GLOBAL_I18N_JS_9910
+ * @tc.name test unitConvert interface from meter to meter-per-second unit
+ * @tc.desc get the unitConvert value
+ */
+ it('i18n_test_9910', 0, function () {
+ console.log('i18n_test_9910 ' + 'start');
+ let value = I18n.Util.unitConvert({unit: 'meter', measureSystem: 'SI'},
+ {unit: 'meter-per-second', measureSystem: 'SI'},
+ 1000,
+ 'zh-CN',
+ 'long');
+ console.log('i18n_test_9910 ' + value);
+ expect(value).assertEqual('1,000米');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_BREAKITERATOR_0100
+ * @tc.name test current interface
+ * @tc.desc check the current result
+ */
+ it('i18n_test_iterator_0100', 0, function () {
+ console.log('i18n_test_iterator_0100 ' + 'start');
+ let iterator =I18n.getLineInstance('en');
+ iterator.setLineBreakText('My name is Tom.Welcome to the sky world.');
+ let value = iterator.current();
+ console.log('i18n_test_iterator_0100 ' + value);
+ expect(value).assertEqual(0);
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_BREAKITERATOR_0200
+ * @tc.name test first interface
+ * @tc.desc check the first
+ */
+ it('i18n_test_iterator_0200', 0, function () {
+ console.log('i18n_test_iterator_0200 ' + 'start');
+ let iterator =I18n.getLineInstance('en');
+ iterator.setLineBreakText('My name is Tom.Welcome to the sky world.');
+ let value = iterator.first();
+ console.log('i18n_test_iterator_0200 ' + value);
+ expect(value).assertEqual(0);
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_BREAKITERATOR_0300
+ * @tc.name test last interface
+ * @tc.desc check the last interface
+ */
+ it('i18n_test_iterator_0300', 0, function () {
+ console.log('i18n_test_iterator_0300 ' + 'start');
+ let iterator =I18n.getLineInstance('en');
+ iterator.setLineBreakText('My name is Tom.Welcome to the sky world.');
+ let value = iterator.last();
+ console.log('i18n_test_iterator_0300 ' + value);
+ expect(value).assertEqual(40);
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_BREAKITERATOR_0400
+ * @tc.name test next interface
+ * @tc.desc check the next interface
+ */
+ it('i18n_test_iterator_0400', 0, function () {
+ console.log('i18n_test_iterator_0400 ' + 'start');
+ let iterator =I18n.getLineInstance('en');
+ iterator.setLineBreakText('My name is Tom.Welcome to the sky world.');
+ let value = iterator.next();
+ console.log('i18n_test_iterator_0400 ' + value);
+ expect(value).assertEqual(3);
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_BREAKITERATOR_0500
+ * @tc.name test next interface with param
+ * @tc.desc check the next interface with param
+ */
+ it('i18n_test_iterator_0500', 0, function () {
+ console.log('i18n_test_iterator_0500 ' + 'start');
+ let iterator =I18n.getLineInstance('en');
+ iterator.setLineBreakText('My name is Tom.Welcome to the sky world.');
+ let value = iterator.next(2);
+ console.log('i18n_test_iterator_0500 ' + value);
+ expect(value).assertEqual(8);
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_BREAKITERATOR_0600
+ * @tc.name test previous interface
+ * @tc.desc check the previous interface
+ */
+ it('i18n_test_iterator_0600', 0, function () {
+ console.log('i18n_test_iterator_0600 ' + 'start');
+ let iterator =I18n.getLineInstance('en');
+ iterator.setLineBreakText('My name is Tom.Welcome to the sky world.');
+ let value = iterator.previous();
+ console.log('i18n_test_iterator_0600 ' + value);
+ expect(value).assertEqual(-1);
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_BREAKITERATOR_0700
+ * @tc.name test following interface
+ * @tc.desc check the following interface
+ */
+ it('i18n_test_iterator_0700', 0, function () {
+ console.log('i18n_test_iterator_0700 ' + 'start');
+ let iterator =I18n.getLineInstance('en');
+ iterator.setLineBreakText('My name is Tom.Welcome to the sky world.');
+ let value = iterator.following(1);
+ console.log('i18n_test_iterator_0700 ' + value);
+ expect(value).assertEqual(3);
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_BREAKITERATOR_0800
+ * @tc.name test getLineBreakText interface
+ * @tc.desc check the getLineBreakText interface
+ */
+ it('i18n_test_iterator_0800', 0, function () {
+ console.log('i18n_test_iterator_0800 ' + 'start');
+ let iterator =I18n.getLineInstance('en');
+ iterator.setLineBreakText('My name is Tom.Welcome to the sky world.');
+ let value = iterator.getLineBreakText();
+ console.log('i18n_test_iterator_0800 ' + value);
+ expect(value).assertEqual('My name is Tom.Welcome to the sky world.');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_BREAKITERATOR_0900
+ * @tc.name test isBoundary interface
+ * @tc.desc check the isBoundary interface
+ */
+ it('i18n_test_iterator_0900', 0, function () {
+ console.log('i18n_test_iterator_0900 ' + 'start');
+ let iterator =I18n.getLineInstance('en');
+ iterator.setLineBreakText('My name is Tom.Welcome to the sky world.');
+ let value = iterator.isBoundary(10);
+ console.log('i18n_test_iterator_0900 ' + value);
+ expect(value).assertFalse();
+ // current
+ let current = iterator.current();
+ console.log('i18n_test_iterator_0900 ' + current);
+ expect(current).assertEqual(11);
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_BREAKITERATOR_1000
+ * @tc.name test iterator interface
+ * @tc.desc check the iterator interface
+ */
+ it('i18n_test_iterator_1000', 0, function () {
+ console.log('i18n_test_iterator_1000 ' + 'start');
+ let iterator =I18n.getLineInstance('en');
+ iterator.setLineBreakText('My name is Tom.Welcome to the sky world.');
+ // current
+ let current = iterator.current();
+ console.log('i18n_test_iterator_1000 ' + current);
+ expect(current).assertEqual(0);
+ // next
+ let next = iterator.next();
+ console.log('i18n_test_iterator_1000 ' + next);
+ expect(next).assertEqual(3);
+ // current
+ let current2 = iterator.current();
+ console.log('i18n_test_iterator_1000 ' + current2);
+ expect(current2).assertEqual(3);
+ // next 5
+ let next2 = iterator.next(5);
+ console.log('i18n_test_iterator_1000 ' + next2);
+ expect(next2).assertEqual(30);
+ // previous
+ let previous = iterator.previous();
+ console.log('i18n_test_iterator_1000 ' + previous);
+ expect(previous).assertEqual(26);
+ // following 2
+ let follwoing = iterator.following(3);
+ console.log('i18n_test_iterator_1000 ' + follwoing);
+ expect(follwoing).assertEqual(8);
+ // current
+ let current3 = iterator.current();
+ console.log('i18n_test_iterator_1000 ' + current3);
+ expect(current3).assertEqual(8);
+ // isBoundary
+ let value = iterator.isBoundary(3);
+ console.log('i18n_test_iterator_1000 ' + value);
+ expect(value).assertTrue();
+ // current
+ let current4 = iterator.current();
+ console.log('i18n_test_iterator_1000 ' + current4);
+ expect(current4).assertEqual(3);
+
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_INDEXUTIL_0100
+ * @tc.name test getIndex interface
+ * @tc.desc check the getIndex interface
+ */
+ it('i18n_test_indexutil_0100', 0, function () {
+ console.log('i18n_test_indexutil_0100 ' + 'start');
+ let index = I18n.getInstance();
+ let value = index.getIndex('a');
+ console.log('i18n_test_indexutil_0100 ' + value);
+ expect(value).assertEqual('A');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_INDEXUTIL_0200
+ * @tc.name test getIndexList interface
+ * @tc.desc check the getIndexList interface
+ */
+ it('i18n_test_indexutil_0200', 0, function () {
+ console.log('i18n_test_indexutil_0200 ' + 'start');
+ let index = I18n.getInstance();
+ let value = index.getIndexList();
+ let len = value.length;
+ console.log('i18n_test_indexutil_0200 ' + value);
+ expect(len).assertLarger(0);
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_INDEXUTIL_0300
+ * @tc.name test addLocale interface
+ * @tc.desc check the addLocale interface
+ */
+ it('i18n_test_indexutil_0300', 0, function () {
+ console.log('i18n_test_indexutil_0300 ' + 'start');
+ let index = I18n.getInstance();
+ index.addLocale('en');
+ let value = index.getIndex('a');
+ console.log('i18n_test_indexutil_0300 ' + value);
+ expect(value).assertEqual('A');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_INDEXUTIL_0400
+ * @tc.name test getInstance interface with zh locale
+ * @tc.desc check the getInstance interface with zh locale
+ */
+ it('i18n_test_indexutil_0400', 0, function () {
+ console.log('i18n_test_indexutil_0400 ' + 'start');
+ let index = I18n.getInstance('zh');
+ let value = index.getIndex('z');
+ console.log('i18n_test_indexutil_0400 ' + value);
+ expect(value).assertEqual('Z');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0100
+ * @tc.name test isDigit interface
+ * @tc.desc check the isDigit interface
+ */
+ it('i18n_test_character_0100', 0, function () {
+ console.log('i18n_test_character_0100 ' + 'start');
+ let value = I18n.Character.isDigit('abc');
+ console.log('i18n_test_character_0100 ' + value);
+ expect(value).assertFalse();
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0120
+ * @tc.name test isDigit interface with 123 param
+ * @tc.desc check the isDigit interface
+ */
+ it('i18n_test_character_0120', 0, function () {
+ console.log('i18n_test_character_0120 ' + 'start');
+ let value = I18n.Character.isDigit('123');
+ console.log('i18n_test_character_0120 ' + value);
+ expect(value).assertTrue();
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0140
+ * @tc.name test isDigit interface with 123abc param
+ * @tc.desc check the isDigit interface
+ */
+ it('i18n_test_character_0140', 0, function () {
+ console.log('i18n_test_character_0140 ' + 'start');
+ let value = I18n.Character.isDigit('123abc');
+ console.log('i18n_test_character_0140 ' + value);
+ expect(value).assertTrue();
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0150
+ * @tc.name test isDigit interface with abc123 param
+ * @tc.desc check the isDigit interface
+ */
+ it('i18n_test_character_0150', 0, function () {
+ console.log('i18n_test_character_0150 ' + 'start');
+ let value = I18n.Character.isDigit('abc123');
+ console.log('i18n_test_character_0150 ' + value);
+ expect(value).assertFalse();
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0160
+ * @tc.name test isDigit interface with null param
+ * @tc.desc check the isDigit interface
+ */
+ it('i18n_test_character_0160', 0, function () {
+ console.log('i18n_test_character_0160 ' + 'start');
+ let value = I18n.Character.isDigit('');
+ console.log('i18n_test_character_0160 ' + value);
+ expect(value).assertFalse();
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0200
+ * @tc.name test isSpaceChar interface with abc param
+ * @tc.desc check the isSpaceChar interface
+ */
+ it('i18n_test_character_0200', 0, function () {
+ console.log('i18n_test_character_0200 ' + 'start');
+ let value = I18n.Character.isSpaceChar('abc');
+ console.log('i18n_test_character_0200 ' + value);
+ expect(value).assertFalse();
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0220
+ * @tc.name test isSpaceChar interface with one space param
+ * @tc.desc check the isSpaceChar interface
+ */
+ it('i18n_test_character_0220', 0, function () {
+ console.log('i18n_test_character_0220 ' + 'start');
+ let value = I18n.Character.isSpaceChar(' ');
+ console.log('i18n_test_character_0220 ' + value);
+ expect(value).assertTrue();
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0240
+ * @tc.name test isSpaceChar interface with multi space param
+ * @tc.desc check the isSpaceChar interface
+ */
+ it('i18n_test_character_0240', 0, function () {
+ console.log('i18n_test_character_0240 ' + 'start');
+ let value = I18n.Character.isSpaceChar(' ');
+ console.log('i18n_test_character_0240--' + value + '--');
+ expect(value).assertTrue();
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0300
+ * @tc.name test isWhitespace interface with abc param
+ * @tc.desc check the isWhitespace interface
+ */
+ it('i18n_test_character_0300', 0, function () {
+ console.log('i18n_test_character_0300 ' + 'start');
+ let value = I18n.Character.isWhitespace('abc');
+ console.log('i18n_test_character_0300 ' + value);
+ expect(value).assertFalse();
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0320
+ * @tc.name test isWhitespace interface with \u0009 param
+ * @tc.desc check the isWhitespace interface
+ */
+ it('i18n_test_character_0320', 0, function () {
+ console.log('i18n_test_character_0320 ' + 'start');
+ let value = I18n.Character.isWhitespace('\u0009');
+ console.log('i18n_test_character_0320--' + value + '--');
+ expect(value).assertTrue();
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0400
+ * @tc.name test isRTL interface with abc param
+ * @tc.desc check the isRTL interface
+ */
+ it('i18n_test_character_0400', 0, function () {
+ console.log('i18n_test_character_0400 ' + 'start');
+ let value = I18n.Character.isRTL('abc');
+ console.log('i18n_test_character_0400 ' + value);
+ expect(value).assertFalse();
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0420
+ * @tc.name test isRTL interface with ١٢٣٤٥٦٧ param
+ * @tc.desc check the isRTL interface
+ */
+ it('i18n_test_character_0420', 0, function () {
+ console.log('i18n_test_character_0420 ' + 'start');
+ let value = I18n.Character.isRTL('١٢٣٤٥٦٧');
+ console.log('i18n_test_character_0420 ' + value);
+ expect(value).assertFalse();
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0440
+ * @tc.name test isRTL interface with 我是小明 param
+ * @tc.desc check the isRTL interface
+ */
+ it('i18n_test_character_0440', 0, function () {
+ console.log('i18n_test_character_0440 ' + 'start');
+ let value = I18n.Character.isRTL('我是小明');
+ console.log('i18n_test_character_0440 ' + value);
+ expect(value).assertFalse();
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0460
+ * @tc.name test isRTL interface with نحن param
+ * @tc.desc check the isRTL interface
+ */
+ it('i18n_test_character_0460', 0, function () {
+ console.log('i18n_test_character_0460 ' + 'start');
+ let value = I18n.Character.isRTL('نحن');
+ console.log('i18n_test_character_0460 ' + value);
+ expect(value).assertTrue();
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0500
+ * @tc.name test isIdeograph interface with abc param
+ * @tc.desc check the isIdeograph interface
+ */
+ it('i18n_test_character_0500', 0, function () {
+ console.log('i18n_test_character_0500 ' + 'start');
+ let value = I18n.Character.isIdeograph('abc');
+ console.log('i18n_test_character_0500 ' + value);
+ expect(value).assertFalse();
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0520
+ * @tc.name test isIdeograph interface with '我' param
+ * @tc.desc check the isIdeograph interface
+ */
+ it('i18n_test_character_0520', 0, function () {
+ console.log('i18n_test_character_0520 ' + 'start');
+ let value = I18n.Character.isIdeograph('我');
+ console.log('i18n_test_character_0520 ' + value);
+ expect(value).assertTrue();
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0540
+ * @tc.name test isIdeograph interface with '우리' param
+ * @tc.desc check the isIdeograph interface
+ */
+ it('i18n_test_character_0540', 0, function () {
+ console.log('i18n_test_character_0540 ' + 'start');
+ let value = I18n.Character.isIdeograph('우리');
+ console.log('i18n_test_character_0540 ' + value);
+ expect(value).assertFalse();
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0560
+ * @tc.name test isIdeograph interface with '私た' param
+ * @tc.desc check the isIdeograph interface
+ */
+ it('i18n_test_character_0560', 0, function () {
+ console.log('i18n_test_character_0560 ' + 'start');
+ let value = I18n.Character.isIdeograph('私たち');
+ console.log('i18n_test_character_0560 ' + value);
+ expect(value).assertTrue();
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0600
+ * @tc.name test isLetter interface with abc param
+ * @tc.desc check the isLetter interface
+ */
+ it('i18n_test_character_0600', 0, function () {
+ console.log('i18n_test_character_0600 ' + 'start');
+ let value = I18n.Character.isLetter('abc');
+ console.log('i18n_test_character_0600 ' + value);
+ expect(value).assertTrue();
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0620
+ * @tc.name test isLetter interface with 123 param
+ * @tc.desc check the isLetter interface
+ */
+ it('i18n_test_character_0620', 0, function () {
+ console.log('i18n_test_character_0620 ' + 'start');
+ let value = I18n.Character.isLetter('123');
+ console.log('i18n_test_character_0620 ' + value);
+ expect(value).assertFalse();
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0640
+ * @tc.name test isLetter interface with abc123 param
+ * @tc.desc check the isLetter interface
+ */
+ it('i18n_test_character_0640', 0, function () {
+ console.log('i18n_test_character_0640 ' + 'start');
+ let value = I18n.Character.isLetter('abc123');
+ console.log('i18n_test_character_0640 ' + value);
+ expect(value).assertTrue();
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0660
+ * @tc.name test isLetter interface with 123abc param
+ * @tc.desc check the isLetter interface
+ */
+ it('i18n_test_character_0660', 0, function () {
+ console.log('i18n_test_character_0660 ' + 'start');
+ let value = I18n.Character.isLetter('123abc');
+ console.log('i18n_test_character_0660 ' + value);
+ expect(value).assertFalse();
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0700
+ * @tc.name test isLowerCase interface with abc param
+ * @tc.desc check the isLowerCase interface
+ */
+ it('i18n_test_character_0700', 0, function () {
+ console.log('i18n_test_character_0700 ' + 'start');
+ let value = I18n.Character.isLowerCase('abc');
+ console.log('i18n_test_character_0700 ' + value);
+ expect(value).assertTrue();
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0720
+ * @tc.name ftest isLowerCase interface with ABC param
+ * @tc.desc check the isLowerCase interface
+ */
+ it('i18n_test_character_0720', 0, function () {
+ console.log('i18n_test_character_0720 ' + 'start');
+ let value = I18n.Character.isLowerCase('ABC');
+ console.log('i18n_test_character_0720 ' + value);
+ expect(value).assertFalse();
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0740
+ * @tc.name test isLowerCase interface with abcDEF param
+ * @tc.desc check the isLowerCase interface
+ */
+ it('i18n_test_character_0740', 0, function () {
+ console.log('i18n_test_character_0740 ' + 'start');
+ let value = I18n.Character.isLowerCase('abcDEF');
+ console.log('i18n_test_character_0740 ' + value);
+ expect(value).assertTrue();
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0760
+ * @tc.name test isLowerCase interface with ABCdef param
+ * @tc.desc check the isLowerCase interface
+ */
+ it('i18n_test_character_0760', 0, function () {
+ console.log('i18n_test_character_0760 ' + 'start');
+ let value = I18n.Character.isLowerCase('ABCdef');
+ console.log('i18n_test_character_0760 ' + value);
+ expect(value).assertFalse();
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0800
+ * @tc.name test isUpperCase interface with ABC param
+ * @tc.desc check the isUpperCase interface
+ */
+ it('i18n_test_character_0800', 0, function () {
+ console.log('i18n_test_character_0800 ' + 'start');
+ let value = I18n.Character.isUpperCase('ABC');
+ console.log('i18n_test_character_0800 ' + value);
+ expect(value).assertTrue();
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0820
+ * @tc.name test isUpperCase interface with abc param
+ * @tc.desc check the isUpperCase interface
+ */
+ it('i18n_test_character_0820', 0, function () {
+ console.log('i18n_test_character_0820 ' + 'start');
+ let value = I18n.Character.isUpperCase('abc');
+ console.log('i18n_test_character_0820 ' + value);
+ expect(value).assertFalse();
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0840
+ * @tc.name test isUpperCase interface with ABCdef param
+ * @tc.desc check the isUpperCase interface
+ */
+ it('i18n_test_character_0840', 0, function () {
+ console.log('i18n_test_character_0840 ' + 'start');
+ let value = I18n.Character.isUpperCase('ABCdef');
+ console.log('i18n_test_character_0840 ' + value);
+ expect(value).assertTrue();
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0860
+ * @tc.name test isUpperCase interface with abcDEF param
+ * @tc.desc check the isUpperCase interface
+ */
+ it('i18n_test_character_0860', 0, function () {
+ console.log('i18n_test_character_0860 ' + 'start');
+ let value = I18n.Character.isUpperCase('abcDEF');
+ console.log('i18n_test_character_0860 ' + value);
+ expect(value).assertFalse();
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0900
+ * @tc.name test getType interface with a param
+ * @tc.desc check the getType interface
+ */
+ it('i18n_test_character_0900', 0, function () {
+ console.log('i18n_test_character_0900 ' + 'start');
+ let value = I18n.Character.getType('a');
+ console.log('i18n_test_character_0900 ' + value);
+ expect(value).assertEqual('U_LOWERCASE_LETTER');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0920
+ * @tc.name ftest getType interface with ABC param
+ * @tc.desc check the getType interface
+ */
+ it('i18n_test_character_0920', 0, function () {
+ console.log('i18n_test_character_0920 ' + 'start');
+ let value = I18n.Character.getType('ABC');
+ console.log('i18n_test_character_0920 ' + value);
+ expect(value).assertEqual('U_UPPERCASE_LETTER');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0940
+ * @tc.name test getType interface with ABCdef param
+ * @tc.desc check the getType interface
+ */
+ it('i18n_test_character_0940', 0, function () {
+ console.log('i18n_test_character_0940 ' + 'start');
+ let value = I18n.Character.getType('ABCdef');
+ console.log('i18n_test_character_0940 ' + value);
+ expect(value).assertEqual('U_UPPERCASE_LETTER');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0960
+ * @tc.name test getType interface with 123 param
+ * @tc.desc check the getType interface
+ */
+ it('i18n_test_character_0960', 0, function () {
+ console.log('i18n_test_character_0960 ' + 'start');
+ let value = I18n.Character.getType('123');
+ console.log('i18n_test_character_0960 ' + value);
+ expect(value).assertEqual('U_DECIMAL_DIGIT_NUMBER');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0970
+ * @tc.name test getType interface with 123abc param
+ * @tc.desc check the getType interface
+ */
+ it('i18n_test_character_0970', 0, function () {
+ console.log('i18n_test_character_0970 ' + 'start');
+ let value = I18n.Character.getType('123abc');
+ console.log('i18n_test_character_0970 ' + value);
+ expect(value).assertEqual('U_DECIMAL_DIGIT_NUMBER');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0980
+ * @tc.name test getType interface with ١٢٣٤٥٦٧ param
+ * @tc.desc check the getType interface
+ */
+ it('i18n_test_character_0980', 0, function () {
+ console.log('i18n_test_character_0980 ' + 'start');
+ let value = I18n.Character.getType('١٢٣٤٥٦٧');
+ console.log('i18n_test_character_0980 ' + value);
+ expect(value).assertEqual('U_DECIMAL_DIGIT_NUMBER');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_CHARACTER_0990
+ * @tc.name test getType interface with multi space param
+ * @tc.desc check the getType interface
+ */
+ it('i18n_test_character_0990', 0, function () {
+ console.log('i18n_test_character_0990 ' + 'start');
+ let value = I18n.Character.getType(' ');
+ console.log('i18n_test_character_0990 ' + value);
+ expect(value).assertEqual('U_SPACE_SEPARATOR');
+ })
+
+ console.log('*************end I18NTest*************');
+})}
diff --git a/global/i18n_standard/intljs/src/main/js/default/test/Intl.test.js b/global/i18n_standard/intljs/src/main/js/test/Intl.test.js
old mode 100755
new mode 100644
similarity index 97%
rename from global/i18n_standard/intljs/src/main/js/default/test/Intl.test.js
rename to global/i18n_standard/intljs/src/main/js/test/Intl.test.js
index 3475543b345bbb20fea907a4ef62ae45ac75dcd8..634e236c3f4cec12f6533a951f5b2136e50032fa
--- a/global/i18n_standard/intljs/src/main/js/default/test/Intl.test.js
+++ b/global/i18n_standard/intljs/src/main/js/test/Intl.test.js
@@ -1,1605 +1,1606 @@
-/*
- * Copyright (C) 2021 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 Intl from '@ohos.intl'
-import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
-
-describe('intlTest', function () {
- console.log('*************start IntlTest*************');
-
- let hour = I18n.is24HourClock();
- console.log('init 24 hour clock value ' + hour);
-
- /* *
- * execute this step before all testcases
- */
- beforeAll(function(){
- console.log('step before all cases in intl.'
- + ' 24hour: ' + I18n.is24HourClock()
- + ' prelang: ' + I18n.getPreferredLanguageList()
- + ' syslocale: ' + I18n.getSystemLocale());
- })
-
- /* *
- * execute this step before every testcase
- */
- beforeEach(function(){
- console.log('step before every case in intl.');
- })
-
- /* *
- * 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 intl.'
- + ' 24hour: ' + I18n.is24HourClock()
- + ' prelang: ' + I18n.getPreferredLanguageList()
- + ' 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_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
- * @tc.desc check the datetime is not null
- */
- it('dateTimeFormat_test_0100', 0, function () {
- let datefmt = new Intl.DateTimeFormat('en-GB');
- expect(datefmt !== null).assertTrue();
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_0120
- * @tc.name format the datetime with en-GB locale
- * @tc.desc check the datetime is not null
- */
- it('dateTimeFormat_test_0120', 0, function () {
- let datefmt = new Intl.DateTimeFormat();
- expect(datefmt !== null).assertTrue();
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_0200
- * @tc.name format the date with zh locale
- * @tc.desc check the date
- */
- it('dateTimeFormat_test_0200', 0, function () {
- let date = new Date(2021, 11, 17, 3, 24, 0);
- let datefmt = new Intl.DateTimeFormat('zh');
- console.log('dateTimeFormat_test_0200 ' + datefmt.format(date));
- expect(datefmt.format(date)).assertEqual('2021/12/17');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_0300
- * @tc.name format the date with en locale
- * @tc.desc check the date
- */
- it('dateTimeFormat_test_0300', 0, function () {
- let date = new Date(2021, 11, 17, 3, 24, 0);
- let datefmt = new Intl.DateTimeFormat('en');
- console.log('dateTimeFormat_test_0300 ' + datefmt.format(date));
- expect(datefmt.format(date)).assertEqual('12/17/21');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_0310
- * @tc.name format the date with en-US locale
- * @tc.desc check the date
- */
- it('dateTimeFormat_test_0310', 0, function () {
- let date = new Date(2021, 11, 17, 3, 24, 0);
- let datefmt = new Intl.DateTimeFormat('en-US');
- console.log('dateTimeFormat_test_0310 ' + datefmt.format(date));
- expect(datefmt.format(date)).assertEqual('12/17/21');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_0320
- * @tc.name format the date with en-GB locale
- * @tc.desc check the date
- */
- it('dateTimeFormat_test_0320', 0, function () {
- let date = new Date(2021, 11, 17, 3, 24, 0);
- let datefmt = new Intl.DateTimeFormat('en-GB');
- console.log('dateTimeFormat_test_0320 ' + datefmt.format(date));
- expect(datefmt.format(date)).assertEqual('17/12/2021');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_0400
- * @tc.name format the date with aa locale
- * @tc.desc check the date
- */
- it('dateTimeFormat_test_0400', 0, function () {
- let date = new Date(2021, 11, 17, 3, 24, 0);
- let datefmt = new Intl.DateTimeFormat('aa');
- let value = datefmt.format(date);
- console.log('dateTimeFormat_test_0400 ' + value);
- expect(value).assertInstanceOf('String');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_0500
- * @tc.name format the hour with ban and zh locale
- * @tc.desc check the hour with ban and zh locale
- */
- it('dateTimeFormat_test_0500', 0, function () {
- let date = new Date(2020, 11, 20, 14, 23, 16);
- let option = { dateStyle: 'full' };
- let datefmt = new Intl.DateTimeFormat(['ban', 'zh'], option);
- console.log('dateTimeFormat_test_0500 ' + datefmt.format(date));
- expect(datefmt.format(date)).assertEqual('2020年12月20日星期日');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_0600
- * @tc.name format the hour with en and zh locale
- * @tc.desc check the hour with en and zh locale
- */
- it('dateTimeFormat_test_0600', 0, function () {
- let date = new Date(2020, 11, 20, 14, 23, 16);
- let option = { dateStyle: 'full' };
- let datefmt = new Intl.DateTimeFormat(['en', 'zh'], option);
- console.log('dateTimeFormat_test_0600 ' + datefmt.format(date));
- expect(datefmt.format(date)).assertEqual('Sunday, December 20, 2020');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_0700
- * @tc.name format the hour with en and ban locale
- * @tc.desc check the hour with en and ban locale
- */
- it('dateTimeFormat_test_0700', 0, function () {
- let date = new Date(2020, 11, 20, 14, 23, 16);
- let option = { dateStyle: 'full' };
- let datefmt = new Intl.DateTimeFormat(['en', 'ban'], option);
- console.log('dateTimeFormat_test_0700 ' + datefmt.format(date));
- expect(datefmt.format(date)).assertEqual('Sunday, December 20, 2020');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_0800
- * @tc.name format the hour without correct locale
- * @tc.desc check the hour without correct locale
- */
- it('dateTimeFormat_test_0800', 0, function () {
- let date = new Date(2020, 11, 20, 14, 23, 16);
- let option = { dateStyle: 'full' };
- let datefmt = new Intl.DateTimeFormat(['abc', 'ban'], option);
- console.log('dateTimeFormat_test_0800 ' + datefmt.format(date));
- expect(datefmt.format(date)).assertContain('2020');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_0900
- * @tc.name format the date with full datestyle and mediu timestyle
- * @tc.desc check the date with full datestyle and mediu timestyle
- */
- it('dateTimeFormat_test_0900', 0, function () {
- let date = new Date(2020, 11, 20, 14, 23, 16);
- let option = { dateStyle: 'full', timeStyle: 'full' };
- let datefmt = new Intl.DateTimeFormat('zh-Hans-CN', option);
- console.log('dateTimeFormat_test_0900 ' + datefmt.format(date));
- expect(datefmt.format(date)).assertContain('2020年12月20日星期日');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_1000
- * @tc.name format the date dateStyle with long style
- * @tc.desc check the dateStyle with long style
- */
- it('dateTimeFormat_test_1000', 0, function () {
- let date = new Date(2020, 11, 20, 14, 23, 16);
- let option = { dateStyle: 'long', timeStyle: 'long' };
- let datefmt = new Intl.DateTimeFormat('zh-CN', option);
- console.log('dateTimeFormat_test_1000 ' + datefmt.resolvedOptions().dateStyle);
- expect(datefmt.resolvedOptions().dateStyle).assertEqual('long');
- expect(datefmt.format(date)).assertContain('2020年12月20日');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_1100
- * @tc.name format the date dateStyle with medium style
- * @tc.desc check the dateStyle with medium style
- */
- it('dateTimeFormat_test_1100', 0, function () {
- let date = new Date(2020, 11, 20, 14, 23, 16);
- let option = { dateStyle: 'medium', timeStyle: 'medium' };
- let datefmt = new Intl.DateTimeFormat('zh-CN', option);
- console.log('dateTimeFormat_test_1100 ' + datefmt.resolvedOptions().dateStyle);
- expect(datefmt.resolvedOptions().dateStyle).assertEqual('medium');
- expect(datefmt.format(date)).assertEqual('2020年12月20日 下午2:23:16');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_1200
- * @tc.name format the date dateStyle with short style
- * @tc.desc check the dateStyle with short style
- */
- it('dateTimeFormat_test_1200', 0, function () {
- let date = new Date(2020, 11, 20, 14, 23, 16);
- let option = { dateStyle: 'short', timeStyle: 'short' };
- let datefmt = new Intl.DateTimeFormat('zh-CN', option);
- console.log('dateTimeFormat_test_1200 ' + datefmt.resolvedOptions().dateStyle);
- expect(datefmt.resolvedOptions().dateStyle).assertEqual('short');
- expect(datefmt.format(date)).assertEqual('2020/12/20 下午2:23');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_1300
- * @tc.name format the date with daterange
- * @tc.desc check the daterange
- */
- it('dateTimeFormat_test_1300', 0, function () {
- let startdate = new Date(2020, 11, 20, 14, 23, 16);
- let enddate = new Date(2020, 11, 21, 14, 23, 16);
- let datefmt = new Intl.DateTimeFormat('en-GB');
- console.log('dateTimeFormat_test_1300 ' + datefmt.formatRange(startdate, enddate));
- expect(datefmt.formatRange(startdate, enddate)).assertEqual('20/12/2020 – 21/12/2020');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_1400
- * @tc.name format the date with daterange when the start and end date is equal
- * @tc.desc check the daterange when the start and end date is equal
- */
- it('dateTimeFormat_test_1400', 0, function () {
- let startdate = new Date(2020, 11, 20, 14, 23, 16);
- let enddate = new Date(2020, 11, 20, 14, 23, 16);
- let datefmt = new Intl.DateTimeFormat('en-GB');
- console.log('dateTimeFormat_test_1400 ' + datefmt.formatRange(startdate, enddate));
- expect(datefmt.formatRange(startdate, enddate)).assertEqual('20/12/2020');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_1500
- * @tc.name format the year、month、day、weekday
- * @tc.desc check the year、month、day、weekday
- */
- it('dateTimeFormat_test_1500', 0, function () {
- let date = new Date(2020, 11, 20, 14, 23, 16);
- let option = { year: 'numeric', month: 'long', day: 'numeric', weekday: 'long' };
- let datefmt = new Intl.DateTimeFormat('ja', option);
- console.log('dateTimeFormat_test_1500 ' + datefmt.format(date));
- expect(datefmt.format(date)).assertEqual('2020年12月20日日曜日');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_1600
- * @tc.name format the timerange with year、month、day、weekday
- * @tc.desc check the timerange with year、month、day、weekday
- */
- it('dateTimeFormat_test_1600', 0, function () {
- let startdate = new Date(2020, 11, 20, 14, 23, 16);
- let enddate = new Date(2021, 4, 5, 10, 5, 3);
- let option = { year: 'numeric', month: 'long', day: 'numeric', weekday: 'long' };
- let datefmt = new Intl.DateTimeFormat('en', option);
- console.log('dateTimeFormat_test_1600 ' + datefmt.formatRange(startdate, enddate));
- expect(datefmt.formatRange(startdate, enddate)).assertEqual('Sunday, December 20, 2020 – Wednesday, May 5, 2021');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_1700
- * @tc.name format the hour&minute&second
- * @tc.desc check the hour&minute&second
- */
- it('dateTimeFormat_test_1700', 0, function () {
- let date = new Date(2020, 11, 20, 14, 23, 16);
- let option = { year: 'numeric', month: 'long', day: 'numeric',
- hour: 'numeric', minute: '2-digit', second: 'numeric', weekday: 'long', era: 'short' };
- let datefmt = new Intl.DateTimeFormat('zh-CN-u-hc-h12', option);
- console.log('dateTimeFormat_test_1700 ' + datefmt.format(date));
- expect(datefmt.format(date)).assertEqual('公元2020年12月20日星期日 下午2:23:16');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_1800
- * @tc.name format the timeZone
- * @tc.desc check the timeZone
- */
- it('dateTimeFormat_test_1800', 0, function () {
- let date = new Date(2020, 3, 14, 15, 5, 3);
- let option = { timeZone: 'America/Los_Angeles', timeZoneName: 'long' };
- let datefmt = new Intl.DateTimeFormat('zh-CN-u-hc-h12', option);
- console.log('dateTimeFormat_test_1800 ' + datefmt.format(date));
- expect(datefmt.format(date).indexOf('北美太平洋夏令时间') !== -1).assertTrue();
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_1900
- * @tc.name format the America/Los_Angeles timeZone
- * @tc.desc check the America/Los_Angeles timeZone
- */
- it('dateTimeFormat_test_1900', 0, function () {
- let option = { timeZone: 'America/Los_Angeles', timeZoneName: 'long' };
- let datefmt = new Intl.DateTimeFormat('zh-CN-u-hc-h12', option);
- console.log('dateTimeFormat_test_1900 ' + datefmt.resolvedOptions().timeZone);
- expect(datefmt.resolvedOptions().timeZone).assertEqual('America/Los_Angeles');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_2000
- * @tc.name format the America/Los_Angeles timeZoneName
- * @tc.desc check the America/Los_Angeles timeZoneName
- */
- it('dateTimeFormat_test_2000', 0, function () {
- let option = { timeZone: 'America/Los_Angeles', timeZoneName: 'long' };
- let datefmt = new Intl.DateTimeFormat('zh-CN-u-hc-h12', option);
- console.log('dateTimeFormat_test_2000 ' + datefmt.resolvedOptions().timeZoneName);
- expect(datefmt.resolvedOptions().timeZoneName).assertEqual('long');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_2100
- * @tc.name format the year
- * @tc.desc check the year
- */
- it('dateTimeFormat_test_2100', 0, function () {
- let option = { year: 'numeric', month: 'long', day: 'numeric',
- hour: 'numeric', minute: '2-digit', second: 'numeric', weekday: 'long', era: 'short' };
- let datefmt = new Intl.DateTimeFormat('zh-CN-u-hc-h12', option);
- console.log('dateTimeFormat_test_2100 ' + datefmt.resolvedOptions().year);
- expect(datefmt.resolvedOptions().year).assertEqual('numeric');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_2200
- * @tc.name format the weekday
- * @tc.desc check the weekday
- */
- it('dateTimeFormat_test_2200', 0, function () {
- let option = { year: 'numeric', month: 'long', day: 'numeric',
- hour: 'numeric', minute: '2-digit', second: 'numeric', weekday: 'long', era: 'short' };
- let datefmt = new Intl.DateTimeFormat('zh-CN-u-hc-h12', option);
- console.log('dateTimeFormat_test_2200 ' + datefmt.resolvedOptions().weekday);
- expect(datefmt.resolvedOptions().weekday).assertEqual('long');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_2300
- * @tc.name format the hour in zh-CN-u-hc-h12
- * @tc.desc check the hour in zh-CN-u-hc-h12
- */
- it('dateTimeFormat_test_2300', 0, function () {
- let option = { year: 'numeric', month: 'long', day: 'numeric',
- hour: 'numeric', minute: '2-digit', second: 'numeric', weekday: 'long', era: 'short' };
- let datefmt = new Intl.DateTimeFormat('zh-CN-u-hc-h12', option);
- console.log('dateTimeFormat_test_2300 ' + datefmt.resolvedOptions().hour);
- expect(datefmt.resolvedOptions().hour).assertEqual('numeric');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_2400
- * @tc.name format the hour in fr-Latn-FR-u-nu-mong
- * @tc.desc check the hour in fr-Latn-FR-u-nu-mong
- */
- it('dateTimeFormat_test_2400', 0, function () {
- let date = new Date(2020, 11, 20, 14, 23, 16);
- let option = { dateStyle: 'full' };
- let datefmt = new Intl.DateTimeFormat('fr-Latn-FR-u-nu-mong', option);
- console.log('dateTimeFormat_test_2400 ' + datefmt.format(date));
- expect(datefmt.format(date)).assertEqual('dimanche ᠒᠐ décembre ᠒᠐᠒᠐');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_2500
- * @tc.name format the hour in zh-CN-u-hc-h12 with matcher
- * @tc.desc check the hour in zh-CN-u-hc-h12 with matcher
- */
- it('dateTimeFormat_test_2500', 0, function () {
- let option = { year: 'numeric', month: 'long', day: 'numeric',
- hour: 'numeric', minute: '2-digit', second: 'numeric', weekday: 'long', era: 'short',
- hourCycle: 'h24',numberingSystem: 'arab', hour12: true, dayPeriod: 'short',
- formatMatcher: 'basic', localeMatcher: 'lookup' };
- let datefmt = new Intl.DateTimeFormat('zh-CN-u-hc-h12', option);
- expect(datefmt.resolvedOptions().locale).assertEqual('zh-CN');
- expect(datefmt.resolvedOptions().hourCycle).assertEqual('h24');
- expect(datefmt.resolvedOptions().numberingSystem).assertEqual('arab');
- expect(datefmt.resolvedOptions().hour12).assertTrue();
- expect(datefmt.resolvedOptions().era).assertEqual('short');
- expect(datefmt.resolvedOptions().month).assertEqual('long');
- expect(datefmt.resolvedOptions().day).assertEqual('numeric');
- expect(datefmt.resolvedOptions().minute).assertEqual('2-digit');
- expect(datefmt.resolvedOptions().second).assertEqual('numeric');
- expect(datefmt.resolvedOptions().dayPeriod).assertEqual('short');
- expect(datefmt.resolvedOptions().formatMatcher).assertEqual('basic');
- expect(datefmt.resolvedOptions().localeMatcher).assertEqual('lookup');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_0100
- * @tc.name format the number in zh
- * @tc.desc check the number in zh
- */
- it('formatNumber_test_0100', 0, function () {
- let numfmt = new Intl.NumberFormat('zh');
- console.log('formatNumber_test_0100 ' + numfmt.format(123456.789));
- expect(numfmt.format(123456.789)).assertEqual('123,456.789');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_0120
- * @tc.name format the number with default locale
- * @tc.desc check the number with default locale
- */
- it('formatNumber_test_0120', 0, function () {
- let numfmt = new Intl.NumberFormat();
- expect(numfmt !== null).assertTrue();
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_0200
- * @tc.name format the number in zh-u-nu-latn
- * @tc.desc check the number in zh-u-nu-latn
- */
- it('formatNumber_test_0200', 0, function () {
- let numfmt = new Intl.NumberFormat('zh-u-nu-latn');
- console.log('formatNumber_test_0200 ' + numfmt.format(123456.789));
- expect(numfmt.format(123456.789)).assertEqual('123,456.789');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_0300
- * @tc.name format the number in zh-u-nu-arab
- * @tc.desc check the number in zh-u-nu-arab
- */
- it('formatNumber_test_0300', 0, function () {
- let numfmt = new Intl.NumberFormat('zh-u-nu-arab');
- console.log('formatNumber_test_0300 ' + numfmt.format(123456.789));
- expect(numfmt.format(123456.789)).assertEqual('١٢٣٬٤٥٦٫٧٨٩');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_0400
- * @tc.name format the number in en
- * @tc.desc check the number in en
- */
- it('formatNumber_test_0400', 0, function () {
- let numfmt = new Intl.NumberFormat('en');
- console.log('formatNumber_test_0400 ' + numfmt.format(123456.789));
- expect(numfmt.format(123456.789)).assertEqual('123,456.789');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_0500
- * @tc.name format the number in en-u-nu-thai
- * @tc.desc check the number in en-u-nu-thai
- */
- it('formatNumber_test_0500', 0, function () {
- let numfmt = new Intl.NumberFormat('en-u-nu-thai');
- console.log('formatNumber_test_0500 ' + numfmt.format(123456.789));
- expect(numfmt.format(123456.789)).assertEqual('๑๒๓,๔๕๖.๗๘๙');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_0600
- * @tc.name format the number in en-GB
- * @tc.desc check the number in en-GB
- */
- it('formatNumber_test_0600', 0, function () {
- let numfmt = new Intl.NumberFormat('en-GB');
- console.log('formatNumber_test_0600 ' + numfmt.format(123456.789));
- expect(numfmt.format(123456.789)).assertEqual('123,456.789');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_0700
- * @tc.name format the number in en-US
- * @tc.desc check the number in en-US
- */
- it('formatNumber_test_0700', 0, function () {
- let numfmt = new Intl.NumberFormat('en-US');
- console.log('formatNumber_test_0700 ' + numfmt.format(123456.789));
- expect(numfmt.format(123456.789)).assertEqual('123,456.789');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_0800
- * @tc.name format the number in aa
- * @tc.desc check the number in aa
- */
- it('formatNumber_test_0800', 0, function () {
- let numfmt = new Intl.NumberFormat('aa');
- console.log('formatNumber_test_0800 ' + numfmt.format(123456.789));
- let lang = I18n.getSystemLanguage();
- if (lang === 'zh') {
- expect(numfmt.format(123456.789)).assertEqual('123,456.789');
- }
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_0900
- * @tc.name format the number in zh and en list
- * @tc.desc check the number in zh and en list
- */
- it('formatNumber_test_0900', 0, function () {
- let numfmt = new Intl.NumberFormat(['zh','en']);
- console.log('formatNumber_test_0900 ' + numfmt.format(123456.789));
- expect(numfmt.format(123456.789)).assertEqual('123,456.789');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_1000
- * @tc.name format the number in en and zh list
- * @tc.desc check the number in en and zh list
- */
- it('formatNumber_test_1000', 0, function () {
- let numfmt = new Intl.NumberFormat(['en','zh']);
- console.log('formatNumber_test_1000 ' + numfmt.format(123456.789));
- expect(numfmt.format(123456.789)).assertEqual('123,456.789');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_1100
- * @tc.name format the number in en and aa list
- * @tc.desc check the number in en and aa list
- */
- it('formatNumber_test_1100', 0, function () {
- let numfmt = new Intl.NumberFormat(['en','aa']);
- console.log('formatNumber_test_1100 ' + numfmt.format(123456.789));
- expect(numfmt.format(123456.789)).assertEqual('123,456.789');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_1200
- * @tc.name format the number in aa and zh list
- * @tc.desc check the number in aa and zh list
- */
- it('formatNumber_test_1200', 0, function () {
- let numfmt = new Intl.NumberFormat(['aa','zh']);
- console.log('formatNumber_test_1200 ' + numfmt.format(123456.789));
- expect(numfmt.format(123456.789)).assertEqual('123,456.789');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_1300
- * @tc.name format the number in aa and bb list
- * @tc.desc check the number in aa and bb list
- */
- it('formatNumber_test_1300', 0, function () {
- let numfmt = new Intl.NumberFormat(['aa','bb']);
- console.log('formatNumber_test_1300 ' + numfmt.format(123456.789));
- let lang = I18n.getSystemLanguage();
- if (lang === 'zh') {
- expect(numfmt.format(123456.789)).assertEqual('123,456.789');
- }
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_1400
- * @tc.name format the number in aa bb and es list
- * @tc.desc check the number in aa bb and es list
- */
- it('formatNumber_test_1400', 0, function () {
- let numfmt = new Intl.NumberFormat(['aa','bb','es']);
- console.log('formatNumber_test_1400 ' + numfmt.format(123456.789));
- expect(numfmt.format(123456.789)).assertEqual('123.456,789');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_1500
- * @tc.name format the number in aa it and bb list
- * @tc.desc check the number in aa it and bb list
- */
- it('formatNumber_test_1500', 0, function () {
- let numfmt = new Intl.NumberFormat(['aa','it','bb']);
- console.log('formatNumber_test_1500 ' + numfmt.format(123456.789));
- expect(numfmt.format(123456.789)).assertEqual('123.456,789');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_1600
- * @tc.name format the number with scientific
- * @tc.desc check the number with scientific
- */
- it('formatNumber_test_1600', 0, function () {
- let numfmt = new Intl.NumberFormat('en-GB', { style: 'decimal', notation: 'scientific' });
- console.log('formatNumber_test_1600 ' + numfmt.format(123456.789));
- expect(numfmt.format(123456.789)).assertEqual('1.234568E5');
- expect(numfmt.resolvedOptions().style).assertEqual('decimal');
- expect(numfmt.resolvedOptions().notation).assertEqual('scientific');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_1700
- * @tc.name format the number with currency EUR
- * @tc.desc check the number with currency EUR
- */
- it('formatNumber_test_1700', 0, function () {
- let numfmt = new Intl.NumberFormat('en-GB', { style: 'currency', currency: 'EUR',
- currencyDisplay: 'name', currencySign: 'accounting', signDisplay: 'always' });
- console.log('formatNumber_test_1700 ' + numfmt.format(123456.789));
- expect(numfmt.format(123456.789)).assertEqual('+123,456.79 euros');
- expect(numfmt.resolvedOptions().locale).assertEqual('en-GB');
- expect(numfmt.resolvedOptions().style).assertEqual('currency');
- expect(numfmt.resolvedOptions().currency).assertEqual('EUR');
- expect(numfmt.resolvedOptions().currencyDisplay).assertEqual('name');
- expect(numfmt.resolvedOptions().currencySign).assertEqual('accounting');
- expect(numfmt.resolvedOptions().signDisplay).assertEqual('always');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_1800
- * @tc.name format the number with currency USD
- * @tc.desc check the number with currency USD
- */
- it('formatNumber_test_1800', 0, function () {
- let numfmt = new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD',
- currencyDisplay: 'code', currencySign: 'accounting', signDisplay: 'always' });
- console.log('formatNumber_test_1800 ' + numfmt.format(123456.789));
- expect(numfmt.format(123456.789)).assertContain('+USD');
- expect(numfmt.format(123456.789)).assertContain('123,456.79');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_1900
- * @tc.name format the number with currency CNY
- * @tc.desc check the number with currency CNY
- */
- it('formatNumber_test_1900', 0, function () {
- let numfmt = new Intl.NumberFormat('zh-CN', { style: 'currency', currency: 'CNY',
- currencyDisplay: 'symbol', currencySign: 'accounting', signDisplay: 'always' });
- console.log('formatNumber_test_1900 ' + numfmt.format(123456.789));
- expect(numfmt.format(123456.789)).assertEqual('+¥123,456.79');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_2000
- * @tc.name format the number with currency JPY
- * @tc.desc check the number with currency JPY
- */
- it('formatNumber_test_2000', 0, function () {
- let numfmt = new Intl.NumberFormat('ja-JP', { style: 'currency', currency: 'JPY',
- currencyDisplay: 'narrowSymbol', currencySign: 'accounting', signDisplay: 'always' });
- console.log('formatNumber_test_2000 ' + numfmt.format(123456.789));
- expect(numfmt.format(123456.789)).assertEqual('+¥123,457');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_2100
- * @tc.name format the number with signDisplay
- * @tc.desc check the number with signDisplay
- */
- it('formatNumber_test_2100', 0, function () {
- let numfmt = new Intl.NumberFormat('en-GB', { style: 'currency', currency: 'EUR',
- currencyDisplay: 'name', currencySign: 'accounting', signDisplay: 'always',
- notation: 'compact', compactDisplay: 'long', localeMatcher: 'lookup' });
- console.log('formatNumber_test_2100 ' + numfmt.format(123456.789));
- expect(numfmt.format(123456.789)).assertEqual('+123 thousand euros');
- expect(numfmt.resolvedOptions().locale).assertEqual('en-GB');
- expect(numfmt.resolvedOptions().style).assertEqual('currency');
- expect(numfmt.resolvedOptions().currency).assertEqual('EUR');
- expect(numfmt.resolvedOptions().currencyDisplay).assertEqual('name');
- expect(numfmt.resolvedOptions().currencySign).assertEqual('accounting');
- expect(numfmt.resolvedOptions().compactDisplay).assertEqual('long');
- expect(numfmt.resolvedOptions().localeMatcher).assertEqual('lookup');
- expect(numfmt.resolvedOptions().signDisplay).assertEqual('always');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_2200
- * @tc.name format the number with meter unit
- * @tc.desc check the number with meter unit
- */
- it('formatNumber_test_2200', 0, function () {
- let numfmt = new Intl.NumberFormat('zh-CN', { style: 'unit', unit: 'meter',
- unitDisplay: 'long', maximumFractionDigits: 2, minimumIntegerDigits: 7 });
- console.log('formatNumber_test_2200 ' + numfmt.format(123456.789));
- expect(numfmt.format(123456.789)).assertEqual('0,123,456.79米');
- expect(numfmt.resolvedOptions().style).assertEqual('unit');
- expect(numfmt.resolvedOptions().unit).assertEqual('meter');
- expect(numfmt.resolvedOptions().unitDisplay).assertEqual('long');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_2250
- * @tc.name format the number with unitUsage
- * @tc.desc check the number with unitUsage
- */
- it('formatNumber_test_2250', 0, function () {
- let numfmt = new Intl.NumberFormat('zh-CN', { style: 'unit', unit: 'meter',
- unitDisplay: 'long', unitUsage: 'length-road' });
- console.log('formatNumber_test_2250 ' + numfmt.format(123456.789));
- expect(numfmt.format(123456.789)).assertEqual('123,456.789米');
- expect(numfmt.resolvedOptions().unitUsage).assertEqual('length-road');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_2260
- * @tc.name format the number with narrow value in unitUsage param
- * @tc.desc check the number with unitUsage
- */
- it('formatNumber_test_2260', 0, function () {
- let numfmt = new Intl.NumberFormat('zh-CN', { style: 'unit', unit: 'meter',
- unitDisplay: 'narrow', unitUsage: 'length-road' });
- console.log('formatNumber_test_2260 ' + numfmt.format(123456.789));
- expect(numfmt.format(123456.789)).assertEqual('123,456.789米');
- expect(numfmt.resolvedOptions().unitUsage).assertEqual('length-road');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_2270
- * @tc.name format the number with short value in unitUsage param
- * @tc.desc check the number with unitUsage
- */
- it('formatNumber_test_2270', 0, function () {
- let numfmt = new Intl.NumberFormat('zh-CN', { style: 'unit', unit: 'meter',
- unitDisplay: 'short', unitUsage: 'length-road' });
- console.log('formatNumber_test_2270 ' + numfmt.format(123456.789));
- expect(numfmt.format(123456.789)).assertEqual('123,456.789米');
- expect(numfmt.resolvedOptions().unitUsage).assertEqual('length-road');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_2280
- * @tc.name format the number with narrow value in unitUsage param
- * @tc.desc check the number with unitUsage
- */
- it('formatNumber_test_2280', 0, function () {
- let numfmt = new Intl.NumberFormat('en-US', { style: 'unit', unit: 'meter',
- unitDisplay: 'narrow', unitUsage: 'length-road' });
- console.log('formatNumber_test_2280 ' + numfmt.format(123456.789));
- expect(numfmt.format(123456.789)).assertEqual('76.712mi');
- expect(numfmt.resolvedOptions().unitUsage).assertEqual('length-road');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_2290
- * @tc.name format the number with short value in unitUsage param
- * @tc.desc check the number with unitUsage
- */
- it('formatNumber_test_2290', 0, function () {
- let numfmt = new Intl.NumberFormat('en-US', { style: 'unit', unit: 'meter',
- unitDisplay: 'short', unitUsage: 'length-road' });
- console.log('formatNumber_test_2290 ' + numfmt.format(123456.789));
- expect(numfmt.format(123456.789)).assertEqual('76.712 mi');
- expect(numfmt.resolvedOptions().unitUsage).assertEqual('length-road');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_2300
- * @tc.name format the number with percetn style
- * @tc.desc check the number with percetn style
- */
- it('formatNumber_test_2300', 0, function () {
- let numfmt = new Intl.NumberFormat('en-CN', { style: 'percent', maximumFractionDigits: 2,
- minimumIntegerDigits: 7 });
- console.log('formatNumber_test_2300 ' + numfmt.format(123456.789));
- expect(numfmt.format(123456.789)).assertEqual('0,123,456.79%');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_2400
- * @tc.name format the number with numberingSystem
- * @tc.desc check the number with numberingSystem
- */
- it('formatNumber_test_2400', 0, function () {
- let numfmt = new Intl.NumberFormat('ar-EG', { numberingSystem: 'arab' });
- console.log('formatNumber_test_2400 ' + numfmt.format(123456.789));
- expect(numfmt.format(123456.789)).assertEqual('١٢٣٬٤٥٦٫٧٨٩');
- expect(numfmt.resolvedOptions().numberingSystem).assertEqual('arab');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_2500
- * @tc.name format the number with style
- * @tc.desc check the number with style
- */
- it('formatNumber_test_2500', 0, function () {
- let numfmt = new Intl.NumberFormat('ar', { style: 'percent', minimumFractionDigits: 1, maximumFractionDigits: 2,
- minimumIntegerDigits: 7, minimumSignificantDigits: 5, maximumSignificantDigits: 10, useGrouping: true });
- console.log('formatNumber_test_2500 ' + numfmt.resolvedOptions().style);
- expect(numfmt.resolvedOptions().style).assertEqual('percent');
- expect(numfmt.resolvedOptions().minimumFractionDigits).assertEqual(1);
- expect(numfmt.resolvedOptions().maximumFractionDigits).assertEqual(2);
- expect(numfmt.resolvedOptions().minimumIntegerDigits).assertEqual(7);
- expect(numfmt.resolvedOptions().minimumSignificantDigits).assertEqual(5);
- expect(numfmt.resolvedOptions().maximumSignificantDigits).assertEqual(10);
- expect(numfmt.resolvedOptions().useGrouping).assertTrue();
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_PLURAL_2600
- * @tc.name get PluralRules
- * @tc.desc check the select result
- */
- it('pluralrules_test_2600', 0, function () {
- let pl = new Intl.PluralRules();
- let value = pl.select(0);
- console.log('pluralrules_test_2600 ' + value);
- expect(value).assertEqual('other');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_PLURAL_2700
- * @tc.name get PluralRules with zh locale
- * @tc.desc check the select result
- */
- it('pluralrules_test_2700', 0, function () {
- let pl = new Intl.PluralRules('zh');
- let value = pl.select(0);
- console.log('pluralrules_test_2700 ' + value);
- expect(value).assertEqual('other');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_PLURAL_2800
- * @tc.name get PluralRules with zh locale and ordinal type
- * @tc.desc check the select result
- */
- it('pluralrules_test_2800', 0, function () {
- let pl = new Intl.PluralRules('zh', {'type': 'ordinal'});
- let value = pl.select(0);
- console.log('pluralrules_test_2800 ' + value);
- expect(value).assertEqual('other');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_PLURAL_2900
- * @tc.name get PluralRules with zh locale and loolup localeMatcher
- * @tc.desc check the select result
- */
- it('pluralrules_test_2900', 0, function () {
- let pl = new Intl.PluralRules('zh', {'localeMatcher': 'lookup'});
- let value = pl.select(0);
- console.log('pluralrules_test_2900 ' + value);
- expect(value).assertEqual('other');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_PLURAL_3000
- * @tc.name get PluralRules with zh locale and minimumIntegerDigits options
- * @tc.desc check the select result
- */
- it('pluralrules_test_3000', 0, function () {
- let pl = new Intl.PluralRules('zh', {'minimumIntegerDigits': 10});
- let value = pl.select(0);
- console.log('pluralrules_test_3000 ' + value);
- expect(value).assertEqual('other');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_PLURAL_3100
- * @tc.name get PluralRules with zh locale and minimumFractionDigits options
- * @tc.desc check the select result
- */
- it('pluralrules_test_3100', 0, function () {
- let pl = new Intl.PluralRules('zh', {'minimumFractionDigits': 11});
- let value = pl.select(0);
- console.log('pluralrules_test_3100 ' + value);
- expect(value).assertEqual('other');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_PLURAL_3200
- * @tc.name get PluralRules with zh locale and maximumFractionDigits options
- * @tc.desc check the select result
- */
- it('pluralrules_test_3200', 0, function () {
- let pl = new Intl.PluralRules('zh', {'maximumFractionDigits': 'lookup'});
- let value = pl.select(0);
- console.log('pluralrules_test_3200 ' + value);
- expect(value).assertEqual('other');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_PLURAL_3300
- * @tc.name get PluralRules with zh locale and minimumSignificantDigits options
- * @tc.desc check the select result
- */
- it('pluralrules_test_3300', 0, function () {
- let pl = new Intl.PluralRules('zh', {'minimumSignificantDigits': 10});
- let value = pl.select(0);
- console.log('pluralrules_test_3300 ' + value);
- expect(value).assertEqual('other');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_PLURAL_3400
- * @tc.name get PluralRules with zh locale and maximumSignificantDigits options
- * @tc.desc check the select result
- */
- it('pluralrules_test_3400', 0, function () {
- let pl = new Intl.PluralRules('zh', {'maximumSignificantDigits': 11});
- let value = pl.select(0);
- console.log('pluralrules_test_3400 ' + value);
- expect(value).assertEqual('other');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_COLLATOR_3500
- * @tc.name compare two different strings
- * @tc.desc check the compare result
- */
- it('collator_test_3500', 0, function () {
- let coll = new Intl.Collator();
- let value = coll.compare('a', 'b');
- console.log('collator_test_3500 ' + value);
- expect(value).assertEqual(-1);
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_COLLATOR_3510
- * @tc.name compare the same strings
- * @tc.desc check the compare result
- */
- it('collator_test_3510', 0, function () {
- let coll = new Intl.Collator();
- let value = coll.compare('a', 'a');
- console.log('collator_test_3100 ' + value);
- expect(value).assertEqual(0);
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_COLLATOR_3520
- * @tc.name compare two different strings and return positive value
- * @tc.desc check the compare result
- */
- it('collator_test_3520', 0, function () {
- let coll = new Intl.Collator();
- let value = coll.compare('b', 'a');
- console.log('collator_test_3200 ' + value);
- expect(value).assertEqual(1);
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_COLLATOR_3600
- * @tc.name compare two different strings with zh locale
- * @tc.desc check the compare result
- */
- it('collator_test_3600', 0, function () {
- let coll = new Intl.Collator('zh');
- let value = coll.compare('a', 'b');
- console.log('collator_test_3600 ' + value);
- expect(value).assertEqual(-1);
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_COLLATOR_3700
- * @tc.name compare two different strings with zh locale and eor collation
- * @tc.desc check the compare result
- */
- it('collator_test_3700', 0, function () {
- let coll = new Intl.Collator('zh', {'collation': 'eor'});
- let value = coll.compare('a', 'b');
- console.log('collator_test_3700 ' + value);
- expect(value).assertEqual(-1);
- expect(coll.resolvedOptions().collation).assertEqual('eor');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_COLLATOR_3800
- * @tc.name compare two different strings with zh locale and base sensitivity
- * @tc.desc check the compare result
- */
- it('collator_test_3800', 0, function () {
- let coll = new Intl.Collator('zh', {'sensitivity': 'base'});
- let value = coll.compare('a', 'b');
- console.log('collator_test_3800 ' + value);
- expect(value).assertEqual(-1);
- expect(coll.resolvedOptions().sensitivity).assertEqual('base');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_COLLATOR_3900
- * @tc.name compare two different strings with zh locale and upper caseFirst
- * @tc.desc check the compare result
- */
- it('collator_test_3900', 0, function () {
- let coll = new Intl.Collator('zh', {'caseFirst': 'upper'});
- let value = coll.compare('a', 'b');
- console.log('collator_test_3900 ' + value);
- expect(value).assertEqual(-1);
- expect(coll.resolvedOptions().caseFirst).assertEqual('upper');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_COLLATOR_4000
- * @tc.name compare two different strings with zh locale and true numeric
- * @tc.desc check the compare result
- */
- it('collator_test_4000', 0, function () {
- let coll = new Intl.Collator('zh', {'numeric': true});
- let value = coll.compare('a', 'b');
- console.log('collator_test_4000 ' + value);
- expect(value).assertEqual(-1);
- expect(coll.resolvedOptions().numeric).assertTrue();
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_COLLATOR_4100
- * @tc.name compare two different strings with zh locale and true ignorePunctuation
- * @tc.desc check the compare result
- */
- it('collator_test_4100', 0, function () {
- let coll = new Intl.Collator('zh', {'ignorePunctuation': true});
- let value = coll.compare('a', 'b');
- console.log('collator_test_4100 ' + value);
- expect(value).assertEqual(-1);
- expect(coll.resolvedOptions().ignorePunctuation).assertTrue();
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_COLLATOR_4200
- * @tc.name compare two different strings with zh locale and sort usage
- * @tc.desc check the compare result
- */
- it('collator_test_4200', 0, function () {
- let coll = new Intl.Collator('zh', {'usage': 'sort'});
- let value = coll.compare('a', 'b');
- console.log('collator_test_4200 ' + value);
- expect(value).assertEqual(-1);
- expect(coll.resolvedOptions().usage).assertEqual('sort');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_COLLATOR_4300
- * @tc.name compare the string with localeMatcher options
- * @tc.desc check the compare result
- */
- it('collator_test_4300', 0, function () {
- let coll = new Intl.Collator('zh', {'localeMatcher': 'lookup'});
- let value = coll.compare('a', 'b');
- console.log('collator_test_4300 ' + value);
- expect(value).assertEqual(-1);
- expect(coll.resolvedOptions().localeMatcher).assertEqual('lookup');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_RELATIVETIMEFORMAT_0100
- * @tc.name format the relativetime with 100 second
- * @tc.desc check the relativetime
- */
- it('i18n_test_relativetimeformat_0100', 0, function () {
- console.log('i18n_test_relativetimeformat_0100 ' + 'start');
- let relativetimefmt = new Intl.RelativeTimeFormat();
- let value = relativetimefmt.format(100,'second');
- console.log('i18n_test_relativetimeformat_0100 ' + value);
- expect(value).assertContain('100');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_RELATIVETIMEFORMAT_0200
- * @tc.name format the relativetime with 100 second in en
- * @tc.desc check the relativetime
- */
- it('i18n_test_relativetimeformat_0200', 0, function () {
- console.log('i18n_test_relativetimeformat_0200 ' + 'start');
- let relativetimefmt = new Intl.RelativeTimeFormat('en');
- let value = relativetimefmt.format(100,'second');
- console.log('i18n_test_relativetimeformat_0200 ' + value);
- expect(value).assertEqual('in 100 seconds');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_RELATIVETIMEFORMAT_0300
- * @tc.name format the relativetime with 100 second in narrow style
- * @tc.desc check the relativetime
- */
- it('i18n_test_relativetimeformat_0300', 0, function () {
- console.log('i18n_test_relativetimeformat_0300 ' + 'start');
- let relativetimefmt = new Intl.RelativeTimeFormat('en', { style: 'narrow' });
- let value = relativetimefmt.format(100,'second');
- console.log('i18n_test_relativetimeformat_0300 ' + value);
- expect(value).assertEqual('in 100 sec.');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_RELATIVETIMEFORMAT_0400
- * @tc.name format the relativetime with 100 second, get the formatToParts value
- * @tc.desc check the formatToParts value
- */
- it('i18n_test_relativetimeformat_0400', 0, function () {
- console.log('i18n_test_relativetimeformat_0400 ' + 'start');
- let relativetimefmt = new Intl.RelativeTimeFormat('en');
- let value = relativetimefmt.formatToParts(100,'second');
- console.log('i18n_test_relativetimeformat_0400 ' + value[0].value + 'value');
- expect(value[0].value).assertEqual('in ');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_RELATIVETIMEFORMAT_0500
- * @tc.name format the relativetime, get the locale options
- * @tc.desc check the relativetime
- */
- it('i18n_test_relativetimeformat_0500', 0, function () {
- console.log('i18n_test_relativetimeformat_0500 ' + 'start');
- let relativetimefmt = new Intl.RelativeTimeFormat('en');
- let value = relativetimefmt.resolvedOptions();
- console.log('i18n_test_relativetimeformat_0500 ' + value);
- expect(value.locale).assertEqual('en');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_RELATIVETIMEFORMAT_0600
- * @tc.name format the relativetime, get the style options
- * @tc.desc check the relativetime
- */
- it('i18n_test_relativetimeformat_0600', 0, function () {
- console.log('i18n_test_relativetimeformat_0600 ' + 'start');
- let relativetimefmt = new Intl.RelativeTimeFormat('en');
- let value = relativetimefmt.resolvedOptions();
- console.log('i18n_test_relativetimeformat_0600 ' + value);
- expect(value.style).assertEqual('long');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_RELATIVETIMEFORMAT_0700
- * @tc.name format the relativetime, get the numeric options
- * @tc.desc check the relativetime
- */
- it('i18n_test_relativetimeformat_0700', 0, function () {
- console.log('i18n_test_relativetimeformat_0700 ' + 'start');
- let relativetimefmt = new Intl.RelativeTimeFormat('en');
- let value = relativetimefmt.resolvedOptions();
- console.log('i18n_test_relativetimeformat_0700 ' + value);
- expect(value.numeric).assertEqual('always');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_RELATIVETIMEFORMAT_0800
- * @tc.name format the relativetime, get the numberingSystem options
- * @tc.desc check the relativetime
- */
- it('i18n_test_relativetimeformat_0800', 0, function () {
- console.log('i18n_test_relativetimeformat_0800 ' + 'start');
- let relativetimefmt = new Intl.RelativeTimeFormat('en');
- let value = relativetimefmt.resolvedOptions();
- console.log('i18n_test_relativetimeformat_0800 ' + value.numberingSystem);
- expect(value.numberingSystem).assertEqual('latn');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_RELATIVETIMEFORMAT_0900
- * @tc.name format the relativetime with localeMatcher options
- * @tc.desc check the relativetime
- */
- it('i18n_test_relativetimeformat_0900', 0, function () {
- console.log('i18n_test_relativetimeformat_0900 ' + 'start');
- let relativetimefmt = new Intl.RelativeTimeFormat('en', { localeMatcher: 'best fit', numeric: 'auto', style: 'narrow' });
- let value = relativetimefmt.resolvedOptions();
- console.log('i18n_test_relativetimeformat_0900 ' + value);
- expect(value.numeric).assertEqual('auto');
- expect(value.style).assertEqual('narrow');
- })
-
- console.log('*************end IntlTest*************');
-})
\ No newline at end of file
+/*
+ * Copyright (C) 2021 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 Intl from '@ohos.intl'
+import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
+
+export default function intlTest() {
+describe('intlTest', function () {
+ console.log('*************start IntlTest*************');
+
+ let hour = I18n.is24HourClock();
+ console.log('init 24 hour clock value ' + hour);
+
+ /* *
+ * execute this step before all testcases
+ */
+ beforeAll(function(){
+ console.log('step before all cases in intl.'
+ + ' 24hour: ' + I18n.is24HourClock()
+ + ' prelang: ' + I18n.getPreferredLanguageList()
+ + ' syslocale: ' + I18n.getSystemLocale());
+ })
+
+ /* *
+ * execute this step before every testcase
+ */
+ beforeEach(function(){
+ console.log('step before every case in intl.');
+ })
+
+ /* *
+ * 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 intl.'
+ + ' 24hour: ' + I18n.is24HourClock()
+ + ' prelang: ' + I18n.getPreferredLanguageList()
+ + ' 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_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
+ * @tc.desc check the datetime is not null
+ */
+ it('dateTimeFormat_test_0100', 0, function () {
+ let datefmt = new Intl.DateTimeFormat('en-GB');
+ expect(datefmt !== null).assertTrue();
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_0120
+ * @tc.name format the datetime with en-GB locale
+ * @tc.desc check the datetime is not null
+ */
+ it('dateTimeFormat_test_0120', 0, function () {
+ let datefmt = new Intl.DateTimeFormat();
+ expect(datefmt !== null).assertTrue();
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_0200
+ * @tc.name format the date with zh locale
+ * @tc.desc check the date
+ */
+ it('dateTimeFormat_test_0200', 0, function () {
+ let date = new Date(2021, 11, 17, 3, 24, 0);
+ let datefmt = new Intl.DateTimeFormat('zh');
+ console.log('dateTimeFormat_test_0200 ' + datefmt.format(date));
+ expect(datefmt.format(date)).assertEqual('2021/12/17');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_0300
+ * @tc.name format the date with en locale
+ * @tc.desc check the date
+ */
+ it('dateTimeFormat_test_0300', 0, function () {
+ let date = new Date(2021, 11, 17, 3, 24, 0);
+ let datefmt = new Intl.DateTimeFormat('en');
+ console.log('dateTimeFormat_test_0300 ' + datefmt.format(date));
+ expect(datefmt.format(date)).assertEqual('12/17/21');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_0310
+ * @tc.name format the date with en-US locale
+ * @tc.desc check the date
+ */
+ it('dateTimeFormat_test_0310', 0, function () {
+ let date = new Date(2021, 11, 17, 3, 24, 0);
+ let datefmt = new Intl.DateTimeFormat('en-US');
+ console.log('dateTimeFormat_test_0310 ' + datefmt.format(date));
+ expect(datefmt.format(date)).assertEqual('12/17/21');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_0320
+ * @tc.name format the date with en-GB locale
+ * @tc.desc check the date
+ */
+ it('dateTimeFormat_test_0320', 0, function () {
+ let date = new Date(2021, 11, 17, 3, 24, 0);
+ let datefmt = new Intl.DateTimeFormat('en-GB');
+ console.log('dateTimeFormat_test_0320 ' + datefmt.format(date));
+ expect(datefmt.format(date)).assertEqual('17/12/2021');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_0400
+ * @tc.name format the date with aa locale
+ * @tc.desc check the date
+ */
+ it('dateTimeFormat_test_0400', 0, function () {
+ let date = new Date(2021, 11, 17, 3, 24, 0);
+ let datefmt = new Intl.DateTimeFormat('aa');
+ let value = datefmt.format(date);
+ console.log('dateTimeFormat_test_0400 ' + value);
+ expect(value).assertInstanceOf('String');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_0500
+ * @tc.name format the hour with ban and zh locale
+ * @tc.desc check the hour with ban and zh locale
+ */
+ it('dateTimeFormat_test_0500', 0, function () {
+ let date = new Date(2020, 11, 20, 14, 23, 16);
+ let option = { dateStyle: 'full' };
+ let datefmt = new Intl.DateTimeFormat(['ban', 'zh'], option);
+ console.log('dateTimeFormat_test_0500 ' + datefmt.format(date));
+ expect(datefmt.format(date)).assertEqual('2020年12月20日星期日');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_0600
+ * @tc.name format the hour with en and zh locale
+ * @tc.desc check the hour with en and zh locale
+ */
+ it('dateTimeFormat_test_0600', 0, function () {
+ let date = new Date(2020, 11, 20, 14, 23, 16);
+ let option = { dateStyle: 'full' };
+ let datefmt = new Intl.DateTimeFormat(['en', 'zh'], option);
+ console.log('dateTimeFormat_test_0600 ' + datefmt.format(date));
+ expect(datefmt.format(date)).assertEqual('Sunday, December 20, 2020');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_0700
+ * @tc.name format the hour with en and ban locale
+ * @tc.desc check the hour with en and ban locale
+ */
+ it('dateTimeFormat_test_0700', 0, function () {
+ let date = new Date(2020, 11, 20, 14, 23, 16);
+ let option = { dateStyle: 'full' };
+ let datefmt = new Intl.DateTimeFormat(['en', 'ban'], option);
+ console.log('dateTimeFormat_test_0700 ' + datefmt.format(date));
+ expect(datefmt.format(date)).assertEqual('Sunday, December 20, 2020');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_0800
+ * @tc.name format the hour without correct locale
+ * @tc.desc check the hour without correct locale
+ */
+ it('dateTimeFormat_test_0800', 0, function () {
+ let date = new Date(2020, 11, 20, 14, 23, 16);
+ let option = { dateStyle: 'full' };
+ let datefmt = new Intl.DateTimeFormat(['abc', 'ban'], option);
+ console.log('dateTimeFormat_test_0800 ' + datefmt.format(date));
+ expect(datefmt.format(date)).assertContain('2020');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_0900
+ * @tc.name format the date with full datestyle and mediu timestyle
+ * @tc.desc check the date with full datestyle and mediu timestyle
+ */
+ it('dateTimeFormat_test_0900', 0, function () {
+ let date = new Date(2020, 11, 20, 14, 23, 16);
+ let option = { dateStyle: 'full', timeStyle: 'full' };
+ let datefmt = new Intl.DateTimeFormat('zh-Hans-CN', option);
+ console.log('dateTimeFormat_test_0900 ' + datefmt.format(date));
+ expect(datefmt.format(date)).assertContain('2020年12月20日星期日');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_1000
+ * @tc.name format the date dateStyle with long style
+ * @tc.desc check the dateStyle with long style
+ */
+ it('dateTimeFormat_test_1000', 0, function () {
+ let date = new Date(2020, 11, 20, 14, 23, 16);
+ let option = { dateStyle: 'long', timeStyle: 'long' };
+ let datefmt = new Intl.DateTimeFormat('zh-CN', option);
+ console.log('dateTimeFormat_test_1000 ' + datefmt.resolvedOptions().dateStyle);
+ expect(datefmt.resolvedOptions().dateStyle).assertEqual('long');
+ expect(datefmt.format(date)).assertContain('2020年12月20日');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_1100
+ * @tc.name format the date dateStyle with medium style
+ * @tc.desc check the dateStyle with medium style
+ */
+ it('dateTimeFormat_test_1100', 0, function () {
+ let date = new Date(2020, 11, 20, 14, 23, 16);
+ let option = { dateStyle: 'medium', timeStyle: 'medium' };
+ let datefmt = new Intl.DateTimeFormat('zh-CN', option);
+ console.log('dateTimeFormat_test_1100 ' + datefmt.resolvedOptions().dateStyle);
+ expect(datefmt.resolvedOptions().dateStyle).assertEqual('medium');
+ expect(datefmt.format(date)).assertEqual('2020年12月20日 下午2:23:16');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_1200
+ * @tc.name format the date dateStyle with short style
+ * @tc.desc check the dateStyle with short style
+ */
+ it('dateTimeFormat_test_1200', 0, function () {
+ let date = new Date(2020, 11, 20, 14, 23, 16);
+ let option = { dateStyle: 'short', timeStyle: 'short' };
+ let datefmt = new Intl.DateTimeFormat('zh-CN', option);
+ console.log('dateTimeFormat_test_1200 ' + datefmt.resolvedOptions().dateStyle);
+ expect(datefmt.resolvedOptions().dateStyle).assertEqual('short');
+ expect(datefmt.format(date)).assertEqual('2020/12/20 下午2:23');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_1300
+ * @tc.name format the date with daterange
+ * @tc.desc check the daterange
+ */
+ it('dateTimeFormat_test_1300', 0, function () {
+ let startdate = new Date(2020, 11, 20, 14, 23, 16);
+ let enddate = new Date(2020, 11, 21, 14, 23, 16);
+ let datefmt = new Intl.DateTimeFormat('en-GB');
+ console.log('dateTimeFormat_test_1300 ' + datefmt.formatRange(startdate, enddate));
+ expect(datefmt.formatRange(startdate, enddate)).assertEqual('20/12/2020 – 21/12/2020');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_1400
+ * @tc.name format the date with daterange when the start and end date is equal
+ * @tc.desc check the daterange when the start and end date is equal
+ */
+ it('dateTimeFormat_test_1400', 0, function () {
+ let startdate = new Date(2020, 11, 20, 14, 23, 16);
+ let enddate = new Date(2020, 11, 20, 14, 23, 16);
+ let datefmt = new Intl.DateTimeFormat('en-GB');
+ console.log('dateTimeFormat_test_1400 ' + datefmt.formatRange(startdate, enddate));
+ expect(datefmt.formatRange(startdate, enddate)).assertEqual('20/12/2020');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_1500
+ * @tc.name format the year、month、day、weekday
+ * @tc.desc check the year、month、day、weekday
+ */
+ it('dateTimeFormat_test_1500', 0, function () {
+ let date = new Date(2020, 11, 20, 14, 23, 16);
+ let option = { year: 'numeric', month: 'long', day: 'numeric', weekday: 'long' };
+ let datefmt = new Intl.DateTimeFormat('ja', option);
+ console.log('dateTimeFormat_test_1500 ' + datefmt.format(date));
+ expect(datefmt.format(date)).assertEqual('2020年12月20日日曜日');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_1600
+ * @tc.name format the timerange with year、month、day、weekday
+ * @tc.desc check the timerange with year、month、day、weekday
+ */
+ it('dateTimeFormat_test_1600', 0, function () {
+ let startdate = new Date(2020, 11, 20, 14, 23, 16);
+ let enddate = new Date(2021, 4, 5, 10, 5, 3);
+ let option = { year: 'numeric', month: 'long', day: 'numeric', weekday: 'long' };
+ let datefmt = new Intl.DateTimeFormat('en', option);
+ console.log('dateTimeFormat_test_1600 ' + datefmt.formatRange(startdate, enddate));
+ expect(datefmt.formatRange(startdate, enddate)).assertEqual('Sunday, December 20, 2020 – Wednesday, May 5, 2021');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_1700
+ * @tc.name format the hour&minute&second
+ * @tc.desc check the hour&minute&second
+ */
+ it('dateTimeFormat_test_1700', 0, function () {
+ let date = new Date(2020, 11, 20, 14, 23, 16);
+ let option = { year: 'numeric', month: 'long', day: 'numeric',
+ hour: 'numeric', minute: '2-digit', second: 'numeric', weekday: 'long', era: 'short' };
+ let datefmt = new Intl.DateTimeFormat('zh-CN-u-hc-h12', option);
+ console.log('dateTimeFormat_test_1700 ' + datefmt.format(date));
+ expect(datefmt.format(date)).assertEqual('公元2020年12月20日星期日 下午2:23:16');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_1800
+ * @tc.name format the timeZone
+ * @tc.desc check the timeZone
+ */
+ it('dateTimeFormat_test_1800', 0, function () {
+ let date = new Date(2020, 3, 14, 15, 5, 3);
+ let option = { timeZone: 'America/Los_Angeles', timeZoneName: 'long' };
+ let datefmt = new Intl.DateTimeFormat('zh-CN-u-hc-h12', option);
+ console.log('dateTimeFormat_test_1800 ' + datefmt.format(date));
+ expect(datefmt.format(date).indexOf('北美太平洋夏令时间') !== -1).assertTrue();
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_1900
+ * @tc.name format the America/Los_Angeles timeZone
+ * @tc.desc check the America/Los_Angeles timeZone
+ */
+ it('dateTimeFormat_test_1900', 0, function () {
+ let option = { timeZone: 'America/Los_Angeles', timeZoneName: 'long' };
+ let datefmt = new Intl.DateTimeFormat('zh-CN-u-hc-h12', option);
+ console.log('dateTimeFormat_test_1900 ' + datefmt.resolvedOptions().timeZone);
+ expect(datefmt.resolvedOptions().timeZone).assertEqual('America/Los_Angeles');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_2000
+ * @tc.name format the America/Los_Angeles timeZoneName
+ * @tc.desc check the America/Los_Angeles timeZoneName
+ */
+ it('dateTimeFormat_test_2000', 0, function () {
+ let option = { timeZone: 'America/Los_Angeles', timeZoneName: 'long' };
+ let datefmt = new Intl.DateTimeFormat('zh-CN-u-hc-h12', option);
+ console.log('dateTimeFormat_test_2000 ' + datefmt.resolvedOptions().timeZoneName);
+ expect(datefmt.resolvedOptions().timeZoneName).assertEqual('long');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_2100
+ * @tc.name format the year
+ * @tc.desc check the year
+ */
+ it('dateTimeFormat_test_2100', 0, function () {
+ let option = { year: 'numeric', month: 'long', day: 'numeric',
+ hour: 'numeric', minute: '2-digit', second: 'numeric', weekday: 'long', era: 'short' };
+ let datefmt = new Intl.DateTimeFormat('zh-CN-u-hc-h12', option);
+ console.log('dateTimeFormat_test_2100 ' + datefmt.resolvedOptions().year);
+ expect(datefmt.resolvedOptions().year).assertEqual('numeric');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_2200
+ * @tc.name format the weekday
+ * @tc.desc check the weekday
+ */
+ it('dateTimeFormat_test_2200', 0, function () {
+ let option = { year: 'numeric', month: 'long', day: 'numeric',
+ hour: 'numeric', minute: '2-digit', second: 'numeric', weekday: 'long', era: 'short' };
+ let datefmt = new Intl.DateTimeFormat('zh-CN-u-hc-h12', option);
+ console.log('dateTimeFormat_test_2200 ' + datefmt.resolvedOptions().weekday);
+ expect(datefmt.resolvedOptions().weekday).assertEqual('long');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_2300
+ * @tc.name format the hour in zh-CN-u-hc-h12
+ * @tc.desc check the hour in zh-CN-u-hc-h12
+ */
+ it('dateTimeFormat_test_2300', 0, function () {
+ let option = { year: 'numeric', month: 'long', day: 'numeric',
+ hour: 'numeric', minute: '2-digit', second: 'numeric', weekday: 'long', era: 'short' };
+ let datefmt = new Intl.DateTimeFormat('zh-CN-u-hc-h12', option);
+ console.log('dateTimeFormat_test_2300 ' + datefmt.resolvedOptions().hour);
+ expect(datefmt.resolvedOptions().hour).assertEqual('numeric');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_2400
+ * @tc.name format the hour in fr-Latn-FR-u-nu-mong
+ * @tc.desc check the hour in fr-Latn-FR-u-nu-mong
+ */
+ it('dateTimeFormat_test_2400', 0, function () {
+ let date = new Date(2020, 11, 20, 14, 23, 16);
+ let option = { dateStyle: 'full' };
+ let datefmt = new Intl.DateTimeFormat('fr-Latn-FR-u-nu-mong', option);
+ console.log('dateTimeFormat_test_2400 ' + datefmt.format(date));
+ expect(datefmt.format(date)).assertEqual('dimanche ᠒᠐ décembre ᠒᠐᠒᠐');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_DATETIME_2500
+ * @tc.name format the hour in zh-CN-u-hc-h12 with matcher
+ * @tc.desc check the hour in zh-CN-u-hc-h12 with matcher
+ */
+ it('dateTimeFormat_test_2500', 0, function () {
+ let option = { year: 'numeric', month: 'long', day: 'numeric',
+ hour: 'numeric', minute: '2-digit', second: 'numeric', weekday: 'long', era: 'short',
+ hourCycle: 'h24',numberingSystem: 'arab', hour12: true, dayPeriod: 'short',
+ formatMatcher: 'basic', localeMatcher: 'lookup' };
+ let datefmt = new Intl.DateTimeFormat('zh-CN-u-hc-h12', option);
+ expect(datefmt.resolvedOptions().locale).assertEqual('zh-CN');
+ expect(datefmt.resolvedOptions().hourCycle).assertEqual('h24');
+ expect(datefmt.resolvedOptions().numberingSystem).assertEqual('arab');
+ expect(datefmt.resolvedOptions().hour12).assertTrue();
+ expect(datefmt.resolvedOptions().era).assertEqual('short');
+ expect(datefmt.resolvedOptions().month).assertEqual('long');
+ expect(datefmt.resolvedOptions().day).assertEqual('numeric');
+ expect(datefmt.resolvedOptions().minute).assertEqual('2-digit');
+ expect(datefmt.resolvedOptions().second).assertEqual('numeric');
+ expect(datefmt.resolvedOptions().dayPeriod).assertEqual('short');
+ expect(datefmt.resolvedOptions().formatMatcher).assertEqual('basic');
+ expect(datefmt.resolvedOptions().localeMatcher).assertEqual('lookup');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_0100
+ * @tc.name format the number in zh
+ * @tc.desc check the number in zh
+ */
+ it('formatNumber_test_0100', 0, function () {
+ let numfmt = new Intl.NumberFormat('zh');
+ console.log('formatNumber_test_0100 ' + numfmt.format(123456.789));
+ expect(numfmt.format(123456.789)).assertEqual('123,456.789');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_0120
+ * @tc.name format the number with default locale
+ * @tc.desc check the number with default locale
+ */
+ it('formatNumber_test_0120', 0, function () {
+ let numfmt = new Intl.NumberFormat();
+ expect(numfmt !== null).assertTrue();
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_0200
+ * @tc.name format the number in zh-u-nu-latn
+ * @tc.desc check the number in zh-u-nu-latn
+ */
+ it('formatNumber_test_0200', 0, function () {
+ let numfmt = new Intl.NumberFormat('zh-u-nu-latn');
+ console.log('formatNumber_test_0200 ' + numfmt.format(123456.789));
+ expect(numfmt.format(123456.789)).assertEqual('123,456.789');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_0300
+ * @tc.name format the number in zh-u-nu-arab
+ * @tc.desc check the number in zh-u-nu-arab
+ */
+ it('formatNumber_test_0300', 0, function () {
+ let numfmt = new Intl.NumberFormat('zh-u-nu-arab');
+ console.log('formatNumber_test_0300 ' + numfmt.format(123456.789));
+ expect(numfmt.format(123456.789)).assertEqual('١٢٣٬٤٥٦٫٧٨٩');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_0400
+ * @tc.name format the number in en
+ * @tc.desc check the number in en
+ */
+ it('formatNumber_test_0400', 0, function () {
+ let numfmt = new Intl.NumberFormat('en');
+ console.log('formatNumber_test_0400 ' + numfmt.format(123456.789));
+ expect(numfmt.format(123456.789)).assertEqual('123,456.789');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_0500
+ * @tc.name format the number in en-u-nu-thai
+ * @tc.desc check the number in en-u-nu-thai
+ */
+ it('formatNumber_test_0500', 0, function () {
+ let numfmt = new Intl.NumberFormat('en-u-nu-thai');
+ console.log('formatNumber_test_0500 ' + numfmt.format(123456.789));
+ expect(numfmt.format(123456.789)).assertEqual('๑๒๓,๔๕๖.๗๘๙');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_0600
+ * @tc.name format the number in en-GB
+ * @tc.desc check the number in en-GB
+ */
+ it('formatNumber_test_0600', 0, function () {
+ let numfmt = new Intl.NumberFormat('en-GB');
+ console.log('formatNumber_test_0600 ' + numfmt.format(123456.789));
+ expect(numfmt.format(123456.789)).assertEqual('123,456.789');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_0700
+ * @tc.name format the number in en-US
+ * @tc.desc check the number in en-US
+ */
+ it('formatNumber_test_0700', 0, function () {
+ let numfmt = new Intl.NumberFormat('en-US');
+ console.log('formatNumber_test_0700 ' + numfmt.format(123456.789));
+ expect(numfmt.format(123456.789)).assertEqual('123,456.789');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_0800
+ * @tc.name format the number in aa
+ * @tc.desc check the number in aa
+ */
+ it('formatNumber_test_0800', 0, function () {
+ let numfmt = new Intl.NumberFormat('aa');
+ console.log('formatNumber_test_0800 ' + numfmt.format(123456.789));
+ let lang = I18n.getSystemLanguage();
+ if (lang === 'zh') {
+ expect(numfmt.format(123456.789)).assertEqual('123,456.789');
+ }
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_0900
+ * @tc.name format the number in zh and en list
+ * @tc.desc check the number in zh and en list
+ */
+ it('formatNumber_test_0900', 0, function () {
+ let numfmt = new Intl.NumberFormat(['zh','en']);
+ console.log('formatNumber_test_0900 ' + numfmt.format(123456.789));
+ expect(numfmt.format(123456.789)).assertEqual('123,456.789');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_1000
+ * @tc.name format the number in en and zh list
+ * @tc.desc check the number in en and zh list
+ */
+ it('formatNumber_test_1000', 0, function () {
+ let numfmt = new Intl.NumberFormat(['en','zh']);
+ console.log('formatNumber_test_1000 ' + numfmt.format(123456.789));
+ expect(numfmt.format(123456.789)).assertEqual('123,456.789');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_1100
+ * @tc.name format the number in en and aa list
+ * @tc.desc check the number in en and aa list
+ */
+ it('formatNumber_test_1100', 0, function () {
+ let numfmt = new Intl.NumberFormat(['en','aa']);
+ console.log('formatNumber_test_1100 ' + numfmt.format(123456.789));
+ expect(numfmt.format(123456.789)).assertEqual('123,456.789');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_1200
+ * @tc.name format the number in aa and zh list
+ * @tc.desc check the number in aa and zh list
+ */
+ it('formatNumber_test_1200', 0, function () {
+ let numfmt = new Intl.NumberFormat(['aa','zh']);
+ console.log('formatNumber_test_1200 ' + numfmt.format(123456.789));
+ expect(numfmt.format(123456.789)).assertEqual('123,456.789');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_1300
+ * @tc.name format the number in aa and bb list
+ * @tc.desc check the number in aa and bb list
+ */
+ it('formatNumber_test_1300', 0, function () {
+ let numfmt = new Intl.NumberFormat(['aa','bb']);
+ console.log('formatNumber_test_1300 ' + numfmt.format(123456.789));
+ let lang = I18n.getSystemLanguage();
+ if (lang === 'zh') {
+ expect(numfmt.format(123456.789)).assertEqual('123,456.789');
+ }
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_1400
+ * @tc.name format the number in aa bb and es list
+ * @tc.desc check the number in aa bb and es list
+ */
+ it('formatNumber_test_1400', 0, function () {
+ let numfmt = new Intl.NumberFormat(['aa','bb','es']);
+ console.log('formatNumber_test_1400 ' + numfmt.format(123456.789));
+ expect(numfmt.format(123456.789)).assertEqual('123.456,789');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_1500
+ * @tc.name format the number in aa it and bb list
+ * @tc.desc check the number in aa it and bb list
+ */
+ it('formatNumber_test_1500', 0, function () {
+ let numfmt = new Intl.NumberFormat(['aa','it','bb']);
+ console.log('formatNumber_test_1500 ' + numfmt.format(123456.789));
+ expect(numfmt.format(123456.789)).assertEqual('123.456,789');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_1600
+ * @tc.name format the number with scientific
+ * @tc.desc check the number with scientific
+ */
+ it('formatNumber_test_1600', 0, function () {
+ let numfmt = new Intl.NumberFormat('en-GB', { style: 'decimal', notation: 'scientific' });
+ console.log('formatNumber_test_1600 ' + numfmt.format(123456.789));
+ expect(numfmt.format(123456.789)).assertEqual('1.234568E5');
+ expect(numfmt.resolvedOptions().style).assertEqual('decimal');
+ expect(numfmt.resolvedOptions().notation).assertEqual('scientific');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_1700
+ * @tc.name format the number with currency EUR
+ * @tc.desc check the number with currency EUR
+ */
+ it('formatNumber_test_1700', 0, function () {
+ let numfmt = new Intl.NumberFormat('en-GB', { style: 'currency', currency: 'EUR',
+ currencyDisplay: 'name', currencySign: 'accounting', signDisplay: 'always' });
+ console.log('formatNumber_test_1700 ' + numfmt.format(123456.789));
+ expect(numfmt.format(123456.789)).assertEqual('+123,456.79 euros');
+ expect(numfmt.resolvedOptions().locale).assertEqual('en-GB');
+ expect(numfmt.resolvedOptions().style).assertEqual('currency');
+ expect(numfmt.resolvedOptions().currency).assertEqual('EUR');
+ expect(numfmt.resolvedOptions().currencyDisplay).assertEqual('name');
+ expect(numfmt.resolvedOptions().currencySign).assertEqual('accounting');
+ expect(numfmt.resolvedOptions().signDisplay).assertEqual('always');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_1800
+ * @tc.name format the number with currency USD
+ * @tc.desc check the number with currency USD
+ */
+ it('formatNumber_test_1800', 0, function () {
+ let numfmt = new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD',
+ currencyDisplay: 'code', currencySign: 'accounting', signDisplay: 'always' });
+ console.log('formatNumber_test_1800 ' + numfmt.format(123456.789));
+ expect(numfmt.format(123456.789)).assertContain('+USD');
+ expect(numfmt.format(123456.789)).assertContain('123,456.79');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_1900
+ * @tc.name format the number with currency CNY
+ * @tc.desc check the number with currency CNY
+ */
+ it('formatNumber_test_1900', 0, function () {
+ let numfmt = new Intl.NumberFormat('zh-CN', { style: 'currency', currency: 'CNY',
+ currencyDisplay: 'symbol', currencySign: 'accounting', signDisplay: 'always' });
+ console.log('formatNumber_test_1900 ' + numfmt.format(123456.789));
+ expect(numfmt.format(123456.789)).assertEqual('+¥123,456.79');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_2000
+ * @tc.name format the number with currency JPY
+ * @tc.desc check the number with currency JPY
+ */
+ it('formatNumber_test_2000', 0, function () {
+ let numfmt = new Intl.NumberFormat('ja-JP', { style: 'currency', currency: 'JPY',
+ currencyDisplay: 'narrowSymbol', currencySign: 'accounting', signDisplay: 'always' });
+ console.log('formatNumber_test_2000 ' + numfmt.format(123456.789));
+ expect(numfmt.format(123456.789)).assertEqual('+¥123,457');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_2100
+ * @tc.name format the number with signDisplay
+ * @tc.desc check the number with signDisplay
+ */
+ it('formatNumber_test_2100', 0, function () {
+ let numfmt = new Intl.NumberFormat('en-GB', { style: 'currency', currency: 'EUR',
+ currencyDisplay: 'name', currencySign: 'accounting', signDisplay: 'always',
+ notation: 'compact', compactDisplay: 'long', localeMatcher: 'lookup' });
+ console.log('formatNumber_test_2100 ' + numfmt.format(123456.789));
+ expect(numfmt.format(123456.789)).assertEqual('+123 thousand euros');
+ expect(numfmt.resolvedOptions().locale).assertEqual('en-GB');
+ expect(numfmt.resolvedOptions().style).assertEqual('currency');
+ expect(numfmt.resolvedOptions().currency).assertEqual('EUR');
+ expect(numfmt.resolvedOptions().currencyDisplay).assertEqual('name');
+ expect(numfmt.resolvedOptions().currencySign).assertEqual('accounting');
+ expect(numfmt.resolvedOptions().compactDisplay).assertEqual('long');
+ expect(numfmt.resolvedOptions().localeMatcher).assertEqual('lookup');
+ expect(numfmt.resolvedOptions().signDisplay).assertEqual('always');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_2200
+ * @tc.name format the number with meter unit
+ * @tc.desc check the number with meter unit
+ */
+ it('formatNumber_test_2200', 0, function () {
+ let numfmt = new Intl.NumberFormat('zh-CN', { style: 'unit', unit: 'meter',
+ unitDisplay: 'long', maximumFractionDigits: 2, minimumIntegerDigits: 7 });
+ console.log('formatNumber_test_2200 ' + numfmt.format(123456.789));
+ expect(numfmt.format(123456.789)).assertEqual('0,123,456.79米');
+ expect(numfmt.resolvedOptions().style).assertEqual('unit');
+ expect(numfmt.resolvedOptions().unit).assertEqual('meter');
+ expect(numfmt.resolvedOptions().unitDisplay).assertEqual('long');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_2250
+ * @tc.name format the number with unitUsage
+ * @tc.desc check the number with unitUsage
+ */
+ it('formatNumber_test_2250', 0, function () {
+ let numfmt = new Intl.NumberFormat('zh-CN', { style: 'unit', unit: 'meter',
+ unitDisplay: 'long', unitUsage: 'length-road' });
+ console.log('formatNumber_test_2250 ' + numfmt.format(123456.789));
+ expect(numfmt.format(123456.789)).assertEqual('123,456.789米');
+ expect(numfmt.resolvedOptions().unitUsage).assertEqual('length-road');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_2260
+ * @tc.name format the number with narrow value in unitUsage param
+ * @tc.desc check the number with unitUsage
+ */
+ it('formatNumber_test_2260', 0, function () {
+ let numfmt = new Intl.NumberFormat('zh-CN', { style: 'unit', unit: 'meter',
+ unitDisplay: 'narrow', unitUsage: 'length-road' });
+ console.log('formatNumber_test_2260 ' + numfmt.format(123456.789));
+ expect(numfmt.format(123456.789)).assertEqual('123,456.789米');
+ expect(numfmt.resolvedOptions().unitUsage).assertEqual('length-road');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_2270
+ * @tc.name format the number with short value in unitUsage param
+ * @tc.desc check the number with unitUsage
+ */
+ it('formatNumber_test_2270', 0, function () {
+ let numfmt = new Intl.NumberFormat('zh-CN', { style: 'unit', unit: 'meter',
+ unitDisplay: 'short', unitUsage: 'length-road' });
+ console.log('formatNumber_test_2270 ' + numfmt.format(123456.789));
+ expect(numfmt.format(123456.789)).assertEqual('123,456.789米');
+ expect(numfmt.resolvedOptions().unitUsage).assertEqual('length-road');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_2280
+ * @tc.name format the number with narrow value in unitUsage param
+ * @tc.desc check the number with unitUsage
+ */
+ it('formatNumber_test_2280', 0, function () {
+ let numfmt = new Intl.NumberFormat('en-US', { style: 'unit', unit: 'meter',
+ unitDisplay: 'narrow', unitUsage: 'length-road' });
+ console.log('formatNumber_test_2280 ' + numfmt.format(123456.789));
+ expect(numfmt.format(123456.789)).assertEqual('76.712mi');
+ expect(numfmt.resolvedOptions().unitUsage).assertEqual('length-road');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_2290
+ * @tc.name format the number with short value in unitUsage param
+ * @tc.desc check the number with unitUsage
+ */
+ it('formatNumber_test_2290', 0, function () {
+ let numfmt = new Intl.NumberFormat('en-US', { style: 'unit', unit: 'meter',
+ unitDisplay: 'short', unitUsage: 'length-road' });
+ console.log('formatNumber_test_2290 ' + numfmt.format(123456.789));
+ expect(numfmt.format(123456.789)).assertEqual('76.712 mi');
+ expect(numfmt.resolvedOptions().unitUsage).assertEqual('length-road');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_2300
+ * @tc.name format the number with percetn style
+ * @tc.desc check the number with percetn style
+ */
+ it('formatNumber_test_2300', 0, function () {
+ let numfmt = new Intl.NumberFormat('en-CN', { style: 'percent', maximumFractionDigits: 2,
+ minimumIntegerDigits: 7 });
+ console.log('formatNumber_test_2300 ' + numfmt.format(123456.789));
+ expect(numfmt.format(123456.789)).assertEqual('0,123,456.79%');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_2400
+ * @tc.name format the number with numberingSystem
+ * @tc.desc check the number with numberingSystem
+ */
+ it('formatNumber_test_2400', 0, function () {
+ let numfmt = new Intl.NumberFormat('ar-EG', { numberingSystem: 'arab' });
+ console.log('formatNumber_test_2400 ' + numfmt.format(123456.789));
+ expect(numfmt.format(123456.789)).assertEqual('١٢٣٬٤٥٦٫٧٨٩');
+ expect(numfmt.resolvedOptions().numberingSystem).assertEqual('arab');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_NUMBER_2500
+ * @tc.name format the number with style
+ * @tc.desc check the number with style
+ */
+ it('formatNumber_test_2500', 0, function () {
+ let numfmt = new Intl.NumberFormat('ar', { style: 'percent', minimumFractionDigits: 1, maximumFractionDigits: 2,
+ minimumIntegerDigits: 7, minimumSignificantDigits: 5, maximumSignificantDigits: 10, useGrouping: true });
+ console.log('formatNumber_test_2500 ' + numfmt.resolvedOptions().style);
+ expect(numfmt.resolvedOptions().style).assertEqual('percent');
+ expect(numfmt.resolvedOptions().minimumFractionDigits).assertEqual(1);
+ expect(numfmt.resolvedOptions().maximumFractionDigits).assertEqual(2);
+ expect(numfmt.resolvedOptions().minimumIntegerDigits).assertEqual(7);
+ expect(numfmt.resolvedOptions().minimumSignificantDigits).assertEqual(5);
+ expect(numfmt.resolvedOptions().maximumSignificantDigits).assertEqual(10);
+ expect(numfmt.resolvedOptions().useGrouping).assertTrue();
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_PLURAL_2600
+ * @tc.name get PluralRules
+ * @tc.desc check the select result
+ */
+ it('pluralrules_test_2600', 0, function () {
+ let pl = new Intl.PluralRules();
+ let value = pl.select(0);
+ console.log('pluralrules_test_2600 ' + value);
+ expect(value).assertEqual('other');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_PLURAL_2700
+ * @tc.name get PluralRules with zh locale
+ * @tc.desc check the select result
+ */
+ it('pluralrules_test_2700', 0, function () {
+ let pl = new Intl.PluralRules('zh');
+ let value = pl.select(0);
+ console.log('pluralrules_test_2700 ' + value);
+ expect(value).assertEqual('other');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_PLURAL_2800
+ * @tc.name get PluralRules with zh locale and ordinal type
+ * @tc.desc check the select result
+ */
+ it('pluralrules_test_2800', 0, function () {
+ let pl = new Intl.PluralRules('zh', {'type': 'ordinal'});
+ let value = pl.select(0);
+ console.log('pluralrules_test_2800 ' + value);
+ expect(value).assertEqual('other');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_PLURAL_2900
+ * @tc.name get PluralRules with zh locale and loolup localeMatcher
+ * @tc.desc check the select result
+ */
+ it('pluralrules_test_2900', 0, function () {
+ let pl = new Intl.PluralRules('zh', {'localeMatcher': 'lookup'});
+ let value = pl.select(0);
+ console.log('pluralrules_test_2900 ' + value);
+ expect(value).assertEqual('other');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_PLURAL_3000
+ * @tc.name get PluralRules with zh locale and minimumIntegerDigits options
+ * @tc.desc check the select result
+ */
+ it('pluralrules_test_3000', 0, function () {
+ let pl = new Intl.PluralRules('zh', {'minimumIntegerDigits': 10});
+ let value = pl.select(0);
+ console.log('pluralrules_test_3000 ' + value);
+ expect(value).assertEqual('other');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_PLURAL_3100
+ * @tc.name get PluralRules with zh locale and minimumFractionDigits options
+ * @tc.desc check the select result
+ */
+ it('pluralrules_test_3100', 0, function () {
+ let pl = new Intl.PluralRules('zh', {'minimumFractionDigits': 11});
+ let value = pl.select(0);
+ console.log('pluralrules_test_3100 ' + value);
+ expect(value).assertEqual('other');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_PLURAL_3200
+ * @tc.name get PluralRules with zh locale and maximumFractionDigits options
+ * @tc.desc check the select result
+ */
+ it('pluralrules_test_3200', 0, function () {
+ let pl = new Intl.PluralRules('zh', {'maximumFractionDigits': 'lookup'});
+ let value = pl.select(0);
+ console.log('pluralrules_test_3200 ' + value);
+ expect(value).assertEqual('other');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_PLURAL_3300
+ * @tc.name get PluralRules with zh locale and minimumSignificantDigits options
+ * @tc.desc check the select result
+ */
+ it('pluralrules_test_3300', 0, function () {
+ let pl = new Intl.PluralRules('zh', {'minimumSignificantDigits': 10});
+ let value = pl.select(0);
+ console.log('pluralrules_test_3300 ' + value);
+ expect(value).assertEqual('other');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_PLURAL_3400
+ * @tc.name get PluralRules with zh locale and maximumSignificantDigits options
+ * @tc.desc check the select result
+ */
+ it('pluralrules_test_3400', 0, function () {
+ let pl = new Intl.PluralRules('zh', {'maximumSignificantDigits': 11});
+ let value = pl.select(0);
+ console.log('pluralrules_test_3400 ' + value);
+ expect(value).assertEqual('other');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_COLLATOR_3500
+ * @tc.name compare two different strings
+ * @tc.desc check the compare result
+ */
+ it('collator_test_3500', 0, function () {
+ let coll = new Intl.Collator();
+ let value = coll.compare('a', 'b');
+ console.log('collator_test_3500 ' + value);
+ expect(value).assertEqual(-1);
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_COLLATOR_3510
+ * @tc.name compare the same strings
+ * @tc.desc check the compare result
+ */
+ it('collator_test_3510', 0, function () {
+ let coll = new Intl.Collator();
+ let value = coll.compare('a', 'a');
+ console.log('collator_test_3100 ' + value);
+ expect(value).assertEqual(0);
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_COLLATOR_3520
+ * @tc.name compare two different strings and return positive value
+ * @tc.desc check the compare result
+ */
+ it('collator_test_3520', 0, function () {
+ let coll = new Intl.Collator();
+ let value = coll.compare('b', 'a');
+ console.log('collator_test_3200 ' + value);
+ expect(value).assertEqual(1);
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_COLLATOR_3600
+ * @tc.name compare two different strings with zh locale
+ * @tc.desc check the compare result
+ */
+ it('collator_test_3600', 0, function () {
+ let coll = new Intl.Collator('zh');
+ let value = coll.compare('a', 'b');
+ console.log('collator_test_3600 ' + value);
+ expect(value).assertEqual(-1);
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_COLLATOR_3700
+ * @tc.name compare two different strings with zh locale and eor collation
+ * @tc.desc check the compare result
+ */
+ it('collator_test_3700', 0, function () {
+ let coll = new Intl.Collator('zh', {'collation': 'eor'});
+ let value = coll.compare('a', 'b');
+ console.log('collator_test_3700 ' + value);
+ expect(value).assertEqual(-1);
+ expect(coll.resolvedOptions().collation).assertEqual('eor');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_COLLATOR_3800
+ * @tc.name compare two different strings with zh locale and base sensitivity
+ * @tc.desc check the compare result
+ */
+ it('collator_test_3800', 0, function () {
+ let coll = new Intl.Collator('zh', {'sensitivity': 'base'});
+ let value = coll.compare('a', 'b');
+ console.log('collator_test_3800 ' + value);
+ expect(value).assertEqual(-1);
+ expect(coll.resolvedOptions().sensitivity).assertEqual('base');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_COLLATOR_3900
+ * @tc.name compare two different strings with zh locale and upper caseFirst
+ * @tc.desc check the compare result
+ */
+ it('collator_test_3900', 0, function () {
+ let coll = new Intl.Collator('zh', {'caseFirst': 'upper'});
+ let value = coll.compare('a', 'b');
+ console.log('collator_test_3900 ' + value);
+ expect(value).assertEqual(-1);
+ expect(coll.resolvedOptions().caseFirst).assertEqual('upper');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_COLLATOR_4000
+ * @tc.name compare two different strings with zh locale and true numeric
+ * @tc.desc check the compare result
+ */
+ it('collator_test_4000', 0, function () {
+ let coll = new Intl.Collator('zh', {'numeric': true});
+ let value = coll.compare('a', 'b');
+ console.log('collator_test_4000 ' + value);
+ expect(value).assertEqual(-1);
+ expect(coll.resolvedOptions().numeric).assertTrue();
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_COLLATOR_4100
+ * @tc.name compare two different strings with zh locale and true ignorePunctuation
+ * @tc.desc check the compare result
+ */
+ it('collator_test_4100', 0, function () {
+ let coll = new Intl.Collator('zh', {'ignorePunctuation': true});
+ let value = coll.compare('a', 'b');
+ console.log('collator_test_4100 ' + value);
+ expect(value).assertEqual(-1);
+ expect(coll.resolvedOptions().ignorePunctuation).assertTrue();
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_COLLATOR_4200
+ * @tc.name compare two different strings with zh locale and sort usage
+ * @tc.desc check the compare result
+ */
+ it('collator_test_4200', 0, function () {
+ let coll = new Intl.Collator('zh', {'usage': 'sort'});
+ let value = coll.compare('a', 'b');
+ console.log('collator_test_4200 ' + value);
+ expect(value).assertEqual(-1);
+ expect(coll.resolvedOptions().usage).assertEqual('sort');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_COLLATOR_4300
+ * @tc.name compare the string with localeMatcher options
+ * @tc.desc check the compare result
+ */
+ it('collator_test_4300', 0, function () {
+ let coll = new Intl.Collator('zh', {'localeMatcher': 'lookup'});
+ let value = coll.compare('a', 'b');
+ console.log('collator_test_4300 ' + value);
+ expect(value).assertEqual(-1);
+ expect(coll.resolvedOptions().localeMatcher).assertEqual('lookup');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_RELATIVETIMEFORMAT_0100
+ * @tc.name format the relativetime with 100 second
+ * @tc.desc check the relativetime
+ */
+ it('i18n_test_relativetimeformat_0100', 0, function () {
+ console.log('i18n_test_relativetimeformat_0100 ' + 'start');
+ let relativetimefmt = new Intl.RelativeTimeFormat();
+ let value = relativetimefmt.format(100,'second');
+ console.log('i18n_test_relativetimeformat_0100 ' + value);
+ expect(value).assertContain('100');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_RELATIVETIMEFORMAT_0200
+ * @tc.name format the relativetime with 100 second in en
+ * @tc.desc check the relativetime
+ */
+ it('i18n_test_relativetimeformat_0200', 0, function () {
+ console.log('i18n_test_relativetimeformat_0200 ' + 'start');
+ let relativetimefmt = new Intl.RelativeTimeFormat('en');
+ let value = relativetimefmt.format(100,'second');
+ console.log('i18n_test_relativetimeformat_0200 ' + value);
+ expect(value).assertEqual('in 100 seconds');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_RELATIVETIMEFORMAT_0300
+ * @tc.name format the relativetime with 100 second in narrow style
+ * @tc.desc check the relativetime
+ */
+ it('i18n_test_relativetimeformat_0300', 0, function () {
+ console.log('i18n_test_relativetimeformat_0300 ' + 'start');
+ let relativetimefmt = new Intl.RelativeTimeFormat('en', { style: 'narrow' });
+ let value = relativetimefmt.format(100,'second');
+ console.log('i18n_test_relativetimeformat_0300 ' + value);
+ expect(value).assertEqual('in 100 sec.');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_RELATIVETIMEFORMAT_0400
+ * @tc.name format the relativetime with 100 second, get the formatToParts value
+ * @tc.desc check the formatToParts value
+ */
+ it('i18n_test_relativetimeformat_0400', 0, function () {
+ console.log('i18n_test_relativetimeformat_0400 ' + 'start');
+ let relativetimefmt = new Intl.RelativeTimeFormat('en');
+ let value = relativetimefmt.formatToParts(100,'second');
+ console.log('i18n_test_relativetimeformat_0400 ' + value[0].value + 'value');
+ expect(value[0].value).assertEqual('in ');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_RELATIVETIMEFORMAT_0500
+ * @tc.name format the relativetime, get the locale options
+ * @tc.desc check the relativetime
+ */
+ it('i18n_test_relativetimeformat_0500', 0, function () {
+ console.log('i18n_test_relativetimeformat_0500 ' + 'start');
+ let relativetimefmt = new Intl.RelativeTimeFormat('en');
+ let value = relativetimefmt.resolvedOptions();
+ console.log('i18n_test_relativetimeformat_0500 ' + value);
+ expect(value.locale).assertEqual('en');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_RELATIVETIMEFORMAT_0600
+ * @tc.name format the relativetime, get the style options
+ * @tc.desc check the relativetime
+ */
+ it('i18n_test_relativetimeformat_0600', 0, function () {
+ console.log('i18n_test_relativetimeformat_0600 ' + 'start');
+ let relativetimefmt = new Intl.RelativeTimeFormat('en');
+ let value = relativetimefmt.resolvedOptions();
+ console.log('i18n_test_relativetimeformat_0600 ' + value);
+ expect(value.style).assertEqual('long');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_RELATIVETIMEFORMAT_0700
+ * @tc.name format the relativetime, get the numeric options
+ * @tc.desc check the relativetime
+ */
+ it('i18n_test_relativetimeformat_0700', 0, function () {
+ console.log('i18n_test_relativetimeformat_0700 ' + 'start');
+ let relativetimefmt = new Intl.RelativeTimeFormat('en');
+ let value = relativetimefmt.resolvedOptions();
+ console.log('i18n_test_relativetimeformat_0700 ' + value);
+ expect(value.numeric).assertEqual('always');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_RELATIVETIMEFORMAT_0800
+ * @tc.name format the relativetime, get the numberingSystem options
+ * @tc.desc check the relativetime
+ */
+ it('i18n_test_relativetimeformat_0800', 0, function () {
+ console.log('i18n_test_relativetimeformat_0800 ' + 'start');
+ let relativetimefmt = new Intl.RelativeTimeFormat('en');
+ let value = relativetimefmt.resolvedOptions();
+ console.log('i18n_test_relativetimeformat_0800 ' + value.numberingSystem);
+ expect(value.numberingSystem).assertEqual('latn');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_RELATIVETIMEFORMAT_0900
+ * @tc.name format the relativetime with localeMatcher options
+ * @tc.desc check the relativetime
+ */
+ it('i18n_test_relativetimeformat_0900', 0, function () {
+ console.log('i18n_test_relativetimeformat_0900 ' + 'start');
+ let relativetimefmt = new Intl.RelativeTimeFormat('en', { localeMatcher: 'best fit', numeric: 'auto', style: 'narrow' });
+ let value = relativetimefmt.resolvedOptions();
+ console.log('i18n_test_relativetimeformat_0900 ' + value);
+ expect(value.numeric).assertEqual('auto');
+ expect(value.style).assertEqual('narrow');
+ })
+
+ console.log('*************end IntlTest*************');
+})}
diff --git a/global/i18n_standard/intljs/src/main/js/default/test/Lang.test.js b/global/i18n_standard/intljs/src/main/js/test/Lang.test.js
old mode 100755
new mode 100644
similarity index 97%
rename from global/i18n_standard/intljs/src/main/js/default/test/Lang.test.js
rename to global/i18n_standard/intljs/src/main/js/test/Lang.test.js
index 72c2324031762151df30ea55fec713e8a19e4002..c9b4ea25f84b7b12c2f0adbad6a45c6d91dd2494
--- a/global/i18n_standard/intljs/src/main/js/default/test/Lang.test.js
+++ b/global/i18n_standard/intljs/src/main/js/test/Lang.test.js
@@ -1,668 +1,669 @@
-/*
- * Copyright (C) 2021 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 Intl from '@ohos.intl'
-import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
-
-describe('LangTest', function () {
- console.log('*************start LangTest*************');
-
- let initPreferredLang = I18n.getPreferredLanguageList();
- let initLen = initPreferredLang.length;
- let hour = I18n.is24HourClock();
-
- /* *
- * get the current preferred language list
- */
- function getCurrentPreferredLang(){
- let value = I18n.getPreferredLanguageList();
- return value;
- }
-
- /* *
- * judge if the lang is in the preferred language list or not
- */
- function isContainLang(langList, lang){
- let len = langList.length;
- for (let i = 0; i < len; i++){
- if(langList[i] == lang){
- return true
- }
- }
- return false
- }
-
- /* *
- * execute this step before all testcases
- */
- beforeAll(function(){
- console.log('step before all cases in lang.'
- + ' 24hour: ' + I18n.is24HourClock()
- + ' prelang: ' + I18n.getPreferredLanguageList()
- + ' syslocale: ' + I18n.getSystemLocale());
- })
-
- /* *
- * execute this step before every testcase
- */
- beforeEach(function(){
- console.log('i18n_test_preferredlanguage_beforeEach ' + getCurrentPreferredLang());
- })
-
- /* *
- * execute this step after every testcase
- */
- afterEach(function(){
- let currLang = getCurrentPreferredLang();
- console.log('i18n_test_preferredlanguage_afterEach ' + currLang);
- })
-
- /* *
- * execute this step after all testcases
- */
- afterAll(function(){
- console.log('step after all cases.'
- + ' 24hour: ' + I18n.is24HourClock()
- + ' prelang: ' + I18n.getPreferredLanguageList()
- + ' syslocale: ' + I18n.getSystemLocale());
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_CLOCK_0100
- * @tc.name test the is24HourClock interface
- * @tc.desc check the value of is24HourClock method
- */
- it('i18n_test_clock_0100', 0, function () {
- console.log('i18n_test_clock_0100 ' + 'start');
- let value = I18n.is24HourClock();
- console.log('i18n_test_clock_0100 ' + value);
- if(hour)
- {
- expect(value).assertTrue();
- }
- else
- {
- expect(value).assertFalse();
- }
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_PREFERREDLANGUAGE_0100
- * @tc.name test the getPreferredLanguageList interface with default value
- * @tc.desc check the value of getPreferredLanguageList method
- */
- it('i18n_test_preferredlanguage_0100', 0, function () {
- console.log('i18n_test_preferredlanguage_0100 ' + 'start');
- let value = I18n.getPreferredLanguageList();
- console.log('i18n_test_preferredlanguage_0100 ' + value);
- expect(value.length).assertLarger(0);
- })
-
- /* *
- * @tc.number SUB_GLOBAL_I18N_JS_PREFERREDLANGUAGE_1000
- * @tc.name test the getFirstPreferredLanguage interface
- * @tc.desc check the value of getFirstPreferredLanguage method
- */
- it('i18n_test_preferredlanguage_1000', 0, function () {
- console.log('i18n_test_preferredlanguage_1000 ' + 'start');
- let value = I18n.getFirstPreferredLanguage();
- console.log('i18n_test_preferredlanguage_1000 ' + value);
- let list = I18n.getPreferredLanguageList();
- console.log('i18n_test_preferredlanguage_1000 ' + list);
- expect(list.length).assertLarger(0);
- if(list[0] == 'zh-Hans'){
- expect(value).assertEqual('zh-Hans');
- }
- else if(list[0] == 'en'){
- expect(value).assertEqual('en');
- }
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_TRANSFER_0100
- * @tc.name transfer from lower to upper
- * @tc.desc check the transfer result
- */
- it('transfer_test_0100', 0, function () {
- let date = 'hello';
- let value = date.toLocaleUpperCase('zh-CN');
- console.log('transfer_test_0100 ' + value);
- expect(value).assertEqual('HELLO');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_TRANSFER_0200
- * @tc.name transfer from upper to lower
- * @tc.desc check the transfer result
- */
- it('transfer_test_0200', 0, function () {
- let date = 'WORLD';
- let value = date.toLocaleLowerCase('zh-CN');
- console.log('transfer_test_0200 ' + value);
- expect(value).assertEqual('world');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_TRANSFER_0300
- * @tc.name transfer to upper
- * @tc.desc check the transfer result
- */
- it('transfer_test_0300', 0, function () {
- let date = 'My name is Jack.';
- let value = date.toLocaleUpperCase('en-US');
- console.log('transfer_test_0300 ' + value);
- expect(value).assertEqual('MY NAME IS JACK.');
- })
-
- /* *
- * @tc.number SUB_GLOBAL_INTL_JS_TRANSFER_0400
- * @tc.name transfer to lower
- * @tc.desc check the transfer result
- */
- it('transfer_test_0400', 0, function () {
- let date = 'The sky is in BLUE-STYLE!';
- let value = date.toLocaleLowerCase('en-US');
- console.log('transfer_test_0400 ' + value);
- 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 == 'UTC' || value == 'Asia/Shanghai' || value == 'GMT').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 == 'GMT' || value == '中国标准时间' || value == '格林尼治标准时间').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 == 'GMT' || value == '中国标准时间' || value == '格林尼治标准时间').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 == 'GMT' || value == '中国标准时间' || value == '格林尼治标准时间').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 == 'GMT' || value == '中国标准时间' || value == '格林尼治标准时间').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
- * @tc.desc get the getUsingLocalDigit value
- */
- it('localdigit_test_0100', 0, function () {
- let value = I18n.getUsingLocalDigit();
- console.log('localdigit_test_0100 ' + value);
- 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.Util.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.Util.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.Util.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.Util.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*************');
-})
\ No newline at end of file
+/*
+ * Copyright (C) 2021 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 Intl from '@ohos.intl'
+import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
+
+export default function LangTest() {
+describe('LangTest', function () {
+ console.log('*************start LangTest*************');
+
+ let initPreferredLang = I18n.getPreferredLanguageList();
+ let initLen = initPreferredLang.length;
+ let hour = I18n.is24HourClock();
+
+ /* *
+ * get the current preferred language list
+ */
+ function getCurrentPreferredLang(){
+ let value = I18n.getPreferredLanguageList();
+ return value;
+ }
+
+ /* *
+ * judge if the lang is in the preferred language list or not
+ */
+ function isContainLang(langList, lang){
+ let len = langList.length;
+ for (let i = 0; i < len; i++){
+ if(langList[i] == lang){
+ return true
+ }
+ }
+ return false
+ }
+
+ /* *
+ * execute this step before all testcases
+ */
+ beforeAll(function(){
+ console.log('step before all cases in lang.'
+ + ' 24hour: ' + I18n.is24HourClock()
+ + ' prelang: ' + I18n.getPreferredLanguageList()
+ + ' syslocale: ' + I18n.getSystemLocale());
+ })
+
+ /* *
+ * execute this step before every testcase
+ */
+ beforeEach(function(){
+ console.log('i18n_test_preferredlanguage_beforeEach ' + getCurrentPreferredLang());
+ })
+
+ /* *
+ * execute this step after every testcase
+ */
+ afterEach(function(){
+ let currLang = getCurrentPreferredLang();
+ console.log('i18n_test_preferredlanguage_afterEach ' + currLang);
+ })
+
+ /* *
+ * execute this step after all testcases
+ */
+ afterAll(function(){
+ console.log('step after all cases.'
+ + ' 24hour: ' + I18n.is24HourClock()
+ + ' prelang: ' + I18n.getPreferredLanguageList()
+ + ' syslocale: ' + I18n.getSystemLocale());
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_CLOCK_0100
+ * @tc.name test the is24HourClock interface
+ * @tc.desc check the value of is24HourClock method
+ */
+ it('i18n_test_clock_0100', 0, function () {
+ console.log('i18n_test_clock_0100 ' + 'start');
+ let value = I18n.is24HourClock();
+ console.log('i18n_test_clock_0100 ' + value);
+ if(hour)
+ {
+ expect(value).assertTrue();
+ }
+ else
+ {
+ expect(value).assertFalse();
+ }
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_PREFERREDLANGUAGE_0100
+ * @tc.name test the getPreferredLanguageList interface with default value
+ * @tc.desc check the value of getPreferredLanguageList method
+ */
+ it('i18n_test_preferredlanguage_0100', 0, function () {
+ console.log('i18n_test_preferredlanguage_0100 ' + 'start');
+ let value = I18n.getPreferredLanguageList();
+ console.log('i18n_test_preferredlanguage_0100 ' + value);
+ expect(value.length).assertLarger(0);
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_I18N_JS_PREFERREDLANGUAGE_1000
+ * @tc.name test the getFirstPreferredLanguage interface
+ * @tc.desc check the value of getFirstPreferredLanguage method
+ */
+ it('i18n_test_preferredlanguage_1000', 0, function () {
+ console.log('i18n_test_preferredlanguage_1000 ' + 'start');
+ let value = I18n.getFirstPreferredLanguage();
+ console.log('i18n_test_preferredlanguage_1000 ' + value);
+ let list = I18n.getPreferredLanguageList();
+ console.log('i18n_test_preferredlanguage_1000 ' + list);
+ expect(list.length).assertLarger(0);
+ if(list[0] == 'zh-Hans'){
+ expect(value).assertEqual('zh-Hans');
+ }
+ else if(list[0] == 'en'){
+ expect(value).assertEqual('en');
+ }
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_TRANSFER_0100
+ * @tc.name transfer from lower to upper
+ * @tc.desc check the transfer result
+ */
+ it('transfer_test_0100', 0, function () {
+ let date = 'hello';
+ let value = date.toLocaleUpperCase('zh-CN');
+ console.log('transfer_test_0100 ' + value);
+ expect(value).assertEqual('HELLO');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_TRANSFER_0200
+ * @tc.name transfer from upper to lower
+ * @tc.desc check the transfer result
+ */
+ it('transfer_test_0200', 0, function () {
+ let date = 'WORLD';
+ let value = date.toLocaleLowerCase('zh-CN');
+ console.log('transfer_test_0200 ' + value);
+ expect(value).assertEqual('world');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_TRANSFER_0300
+ * @tc.name transfer to upper
+ * @tc.desc check the transfer result
+ */
+ it('transfer_test_0300', 0, function () {
+ let date = 'My name is Jack.';
+ let value = date.toLocaleUpperCase('en-US');
+ console.log('transfer_test_0300 ' + value);
+ expect(value).assertEqual('MY NAME IS JACK.');
+ })
+
+ /* *
+ * @tc.number SUB_GLOBAL_INTL_JS_TRANSFER_0400
+ * @tc.name transfer to lower
+ * @tc.desc check the transfer result
+ */
+ it('transfer_test_0400', 0, function () {
+ let date = 'The sky is in BLUE-STYLE!';
+ let value = date.toLocaleLowerCase('en-US');
+ console.log('transfer_test_0400 ' + value);
+ 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 == 'UTC' || value == 'Asia/Shanghai' || value == 'GMT').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 == 'GMT' || value == '中国标准时间' || value == '格林尼治标准时间').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 == 'GMT' || value == '中国标准时间' || value == '格林尼治标准时间').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 == 'GMT' || value == '中国标准时间' || value == '格林尼治标准时间').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 == 'GMT' || value == '中国标准时间' || value == '格林尼治标准时间').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
+ * @tc.desc get the getUsingLocalDigit value
+ */
+ it('localdigit_test_0100', 0, function () {
+ let value = I18n.getUsingLocalDigit();
+ console.log('localdigit_test_0100 ' + value);
+ 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.Util.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.Util.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.Util.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.Util.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*************');
+})}
diff --git a/global/i18n_standard/intljs/src/main/js/default/test/List.test.js b/global/i18n_standard/intljs/src/main/js/test/List.test.js
old mode 100755
new mode 100644
similarity index 74%
rename from global/i18n_standard/intljs/src/main/js/default/test/List.test.js
rename to global/i18n_standard/intljs/src/main/js/test/List.test.js
index f15b8fc747aad5bb71d48e5d603b60d98e9c39a5..468257f5c2a9f9f43a0d9f56dedae8588b66d572
--- a/global/i18n_standard/intljs/src/main/js/default/test/List.test.js
+++ b/global/i18n_standard/intljs/src/main/js/test/List.test.js
@@ -12,6 +12,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-require('./I18n.test.js')
-require('./Intl.test.js')
-require('./Lang.test.js')
\ No newline at end of file
+import I18nTest from './I18n.test.js'
+import intlTest from './Intl.test.js'
+import LangTest from './Lang.test.js'
+export default function testsuite() {
+I18nTest()
+intlTest()
+LangTest()
+}
diff --git a/global/i18n_standard/intljs/src/main/resources/base/element/string.json b/global/i18n_standard/intljs/src/main/resources/base/element/string.json
old mode 100755
new mode 100644
index fac1f3a7cbdd54561048bb8e4211abd3340efe97..281c42d6ca6471b9b6d541aa0f69de9b74eb2539
--- a/global/i18n_standard/intljs/src/main/resources/base/element/string.json
+++ b/global/i18n_standard/intljs/src/main/resources/base/element/string.json
@@ -7,6 +7,22 @@
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
- }
+ },
+ {
+ "name": "MainAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "MainAbility_label",
+ "value": "label"
+ },
+ {
+ "name": "TestAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "TestAbility_label",
+ "value": "label"
+ }
]
}
\ No newline at end of file
diff --git a/global/i18n_standard/intljs/src/main/resources/base/media/icon.png b/global/i18n_standard/intljs/src/main/resources/base/media/icon.png
old mode 100755
new mode 100644