diff options
author | Fabrice Di Meglio <fdimeglio@google.com> | 2011-06-15 17:49:24 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-06-15 17:49:24 -0700 |
commit | 7e27e489d86888ac8bfc7852379a58178313fa5c (patch) | |
tree | 51e65eb8cdc868131caeb1c15c088626d9377e83 /core/tests | |
parent | c1972e1f65722283a96847c175980c586f8246f3 (diff) | |
parent | a47f45e4829f812ff47f9e5c9370b02284d92ae8 (diff) | |
download | frameworks_base-7e27e489d86888ac8bfc7852379a58178313fa5c.zip frameworks_base-7e27e489d86888ac8bfc7852379a58178313fa5c.tar.gz frameworks_base-7e27e489d86888ac8bfc7852379a58178313fa5c.tar.bz2 |
Merge "Introduce LocalUtil and getLayoutDirectionFromLocale() now use likelySubtags"
Diffstat (limited to 'core/tests')
-rw-r--r-- | core/tests/coretests/src/android/content/res/ConfigurationTest.java | 198 | ||||
-rw-r--r-- | core/tests/coretests/src/android/util/LocaleUtilTest.java | 197 |
2 files changed, 197 insertions, 198 deletions
diff --git a/core/tests/coretests/src/android/content/res/ConfigurationTest.java b/core/tests/coretests/src/android/content/res/ConfigurationTest.java deleted file mode 100644 index 54a5e4e..0000000 --- a/core/tests/coretests/src/android/content/res/ConfigurationTest.java +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * 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. - */ - -package android.content.res; - -import java.util.Locale; - -import android.test.AndroidTestCase; -import dalvik.annotation.TestLevel; -import dalvik.annotation.TestTargetNew; - -public class ConfigurationTest extends AndroidTestCase { - - @TestTargetNew( - level = TestLevel.COMPLETE, - method = "getLayoutDirectionFromLocale", - args = {Locale.class} - ) - public void testGetLayoutDirectionFromLocale() { - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_UNDEFINED_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(null)); - - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(Locale.ENGLISH)); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(Locale.CANADA)); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(Locale.CANADA_FRENCH)); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(Locale.FRANCE)); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(Locale.FRENCH)); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(Locale.GERMAN)); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(Locale.GERMANY)); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(Locale.ITALIAN)); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(Locale.ITALY)); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(Locale.UK)); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(Locale.US)); - - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_UNDEFINED_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(Locale.ROOT)); - - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(Locale.CHINA)); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(Locale.CHINESE)); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(Locale.JAPAN)); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(Locale.JAPANESE)); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(Locale.KOREA)); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(Locale.KOREAN)); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(Locale.PRC)); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(Locale.SIMPLIFIED_CHINESE)); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(Locale.TAIWAN)); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(Locale.TRADITIONAL_CHINESE)); - - Locale locale = new Locale("ar"); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(locale)); - locale = new Locale("ar", "AE"); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(locale)); - locale = new Locale("ar", "BH"); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(locale)); - locale = new Locale("ar", "DZ"); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(locale)); - locale = new Locale("ar", "EG"); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(locale)); - locale = new Locale("ar", "IQ"); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(locale)); - locale = new Locale("ar", "JO"); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(locale)); - locale = new Locale("ar", "KW"); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(locale)); - locale = new Locale("ar", "LB"); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(locale)); - locale = new Locale("ar", "LY"); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(locale)); - locale = new Locale("ar", "MA"); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(locale)); - locale = new Locale("ar", "OM"); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(locale)); - locale = new Locale("ar", "QA"); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(locale)); - locale = new Locale("ar", "SA"); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(locale)); - locale = new Locale("ar", "SD"); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(locale)); - locale = new Locale("ar", "SY"); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(locale)); - locale = new Locale("ar", "TN"); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(locale)); - locale = new Locale("ar", "YE"); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(locale)); - - locale = new Locale("fa"); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(locale)); - locale = new Locale("fa", "AF"); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(locale)); - locale = new Locale("fa", "IR"); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(locale)); - - locale = new Locale("iw"); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(locale)); - locale = new Locale("iw", "IL"); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(locale)); - locale = new Locale("he"); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(locale)); - locale = new Locale("he", "IL"); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(locale)); - - // The following test will not pass until we are able to take care about the scrip subtag - // thru having the "likelySubTags" file into ICU4C -// locale = new Locale("pa_Arab"); -// assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, -// Configuration.getLayoutDirectionFromLocale(locale)); -// locale = new Locale("pa_Arab", "PK"); -// assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, -// Configuration.getLayoutDirectionFromLocale(locale)); - - locale = new Locale("ps"); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(locale)); - locale = new Locale("ps", "AF"); - assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, - Configuration.getLayoutDirectionFromLocale(locale)); - - // The following test will not work as the localized display name would be "Urdu" with ICU 4.4 - // We will need ICU 4.6 to get the correct localized display name -// locale = new Locale("ur"); -// assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, -// Configuration.getLayoutDirectionFromLocale(locale)); -// locale = new Locale("ur", "IN"); -// assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, -// Configuration.getLayoutDirectionFromLocale(locale)); -// locale = new Locale("ur", "PK"); -// assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, -// Configuration.getLayoutDirectionFromLocale(locale)); - - // The following test will not pass until we are able to take care about the scrip subtag - // thru having the "likelySubTags" file into ICU4C -// locale = new Locale("uz_Arab"); -// assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, -// Configuration.getLayoutDirectionFromLocale(locale)); -// locale = new Locale("uz_Arab", "AF"); -// assertEquals(Configuration.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, -// Configuration.getLayoutDirectionFromLocale(locale)); - } -} diff --git a/core/tests/coretests/src/android/util/LocaleUtilTest.java b/core/tests/coretests/src/android/util/LocaleUtilTest.java new file mode 100644 index 0000000..a3b4948 --- /dev/null +++ b/core/tests/coretests/src/android/util/LocaleUtilTest.java @@ -0,0 +1,197 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * 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. + */ + +package android.util; + +import java.util.Locale; + +import android.content.res.Configuration; +import android.test.AndroidTestCase; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTargetNew; + +import static android.util.LocaleUtil.TEXT_LAYOUT_DIRECTION_UNDEFINED_DO_NOT_USE; +import static android.util.LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE; +import static android.util.LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE; + +public class LocaleUtilTest extends AndroidTestCase { + + @TestTargetNew( + level = TestLevel.COMPLETE, + method = "getLayoutDirectionFromLocale", + args = {Locale.class} + ) + public void testGetLayoutDirectionFromLocale() { + assertEquals(TEXT_LAYOUT_DIRECTION_UNDEFINED_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(null)); + + assertEquals(TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(Locale.ENGLISH)); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(Locale.CANADA)); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(Locale.CANADA_FRENCH)); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(Locale.FRANCE)); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(Locale.FRENCH)); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(Locale.GERMAN)); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(Locale.GERMANY)); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(Locale.ITALIAN)); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(Locale.ITALY)); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(Locale.UK)); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(Locale.US)); + + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_UNDEFINED_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(Locale.ROOT)); + + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(Locale.CHINA)); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(Locale.CHINESE)); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(Locale.JAPAN)); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(Locale.JAPANESE)); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(Locale.KOREA)); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(Locale.KOREAN)); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(Locale.PRC)); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(Locale.SIMPLIFIED_CHINESE)); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(Locale.TAIWAN)); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(Locale.TRADITIONAL_CHINESE)); + + Locale locale = new Locale("ar"); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(locale)); + locale = new Locale("ar", "AE"); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(locale)); + locale = new Locale("ar", "BH"); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(locale)); + locale = new Locale("ar", "DZ"); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(locale)); + locale = new Locale("ar", "EG"); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(locale)); + locale = new Locale("ar", "IQ"); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(locale)); + locale = new Locale("ar", "JO"); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(locale)); + locale = new Locale("ar", "KW"); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(locale)); + locale = new Locale("ar", "LB"); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(locale)); + locale = new Locale("ar", "LY"); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(locale)); + locale = new Locale("ar", "MA"); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(locale)); + locale = new Locale("ar", "OM"); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(locale)); + locale = new Locale("ar", "QA"); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(locale)); + locale = new Locale("ar", "SA"); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(locale)); + locale = new Locale("ar", "SD"); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(locale)); + locale = new Locale("ar", "SY"); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(locale)); + locale = new Locale("ar", "TN"); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(locale)); + locale = new Locale("ar", "YE"); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(locale)); + + locale = new Locale("fa"); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(locale)); + locale = new Locale("fa", "AF"); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(locale)); + locale = new Locale("fa", "IR"); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(locale)); + + locale = new Locale("iw"); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(locale)); + locale = new Locale("iw", "IL"); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(locale)); + locale = new Locale("he"); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(locale)); + locale = new Locale("he", "IL"); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(locale)); + + locale = new Locale("pa_Arab"); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(locale)); + locale = new Locale("pa_Arab", "PK"); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(locale)); + + locale = new Locale("ps"); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(locale)); + locale = new Locale("ps", "AF"); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(locale)); + + locale = new Locale("ur"); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(locale)); + locale = new Locale("ur", "IN"); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(locale)); + locale = new Locale("ur", "PK"); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(locale)); + + locale = new Locale("uz_Arab"); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(locale)); + locale = new Locale("uz_Arab", "AF"); + assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + LocaleUtil.getLayoutDirectionFromLocale(locale)); + } +} |