diff options
Diffstat (limited to 'core/tests')
-rw-r--r-- | core/tests/coretests/src/android/util/LocaleUtilTest.java | 119 |
1 files changed, 60 insertions, 59 deletions
diff --git a/core/tests/coretests/src/android/util/LocaleUtilTest.java b/core/tests/coretests/src/android/util/LocaleUtilTest.java index ff3d539..0ca6043 100644 --- a/core/tests/coretests/src/android/util/LocaleUtilTest.java +++ b/core/tests/coretests/src/android/util/LocaleUtilTest.java @@ -22,7 +22,8 @@ import android.test.AndroidTestCase; import dalvik.annotation.TestLevel; import dalvik.annotation.TestTargetNew; -import static android.util.LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE; +import static android.view.View.LAYOUT_DIRECTION_LTR; +import static android.view.View.LAYOUT_DIRECTION_RTL; public class LocaleUtilTest extends AndroidTestCase { @@ -32,168 +33,168 @@ public class LocaleUtilTest extends AndroidTestCase { args = {Locale.class} ) public void testGetLayoutDirectionFromLocale() { - assertEquals(TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_LTR, LocaleUtil.getLayoutDirectionFromLocale(null)); - assertEquals(TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_LTR, LocaleUtil.getLayoutDirectionFromLocale(Locale.ENGLISH)); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_LTR, LocaleUtil.getLayoutDirectionFromLocale(Locale.CANADA)); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_LTR, LocaleUtil.getLayoutDirectionFromLocale(Locale.CANADA_FRENCH)); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_LTR, LocaleUtil.getLayoutDirectionFromLocale(Locale.FRANCE)); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_LTR, LocaleUtil.getLayoutDirectionFromLocale(Locale.FRENCH)); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_LTR, LocaleUtil.getLayoutDirectionFromLocale(Locale.GERMAN)); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_LTR, LocaleUtil.getLayoutDirectionFromLocale(Locale.GERMANY)); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_LTR, LocaleUtil.getLayoutDirectionFromLocale(Locale.ITALIAN)); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_LTR, LocaleUtil.getLayoutDirectionFromLocale(Locale.ITALY)); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_LTR, LocaleUtil.getLayoutDirectionFromLocale(Locale.UK)); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_LTR, LocaleUtil.getLayoutDirectionFromLocale(Locale.US)); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_LTR, LocaleUtil.getLayoutDirectionFromLocale(Locale.ROOT)); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_LTR, LocaleUtil.getLayoutDirectionFromLocale(Locale.CHINA)); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_LTR, LocaleUtil.getLayoutDirectionFromLocale(Locale.CHINESE)); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_LTR, LocaleUtil.getLayoutDirectionFromLocale(Locale.JAPAN)); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_LTR, LocaleUtil.getLayoutDirectionFromLocale(Locale.JAPANESE)); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_LTR, LocaleUtil.getLayoutDirectionFromLocale(Locale.KOREA)); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_LTR, LocaleUtil.getLayoutDirectionFromLocale(Locale.KOREAN)); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_LTR, LocaleUtil.getLayoutDirectionFromLocale(Locale.PRC)); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_LTR, LocaleUtil.getLayoutDirectionFromLocale(Locale.SIMPLIFIED_CHINESE)); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_LTR, LocaleUtil.getLayoutDirectionFromLocale(Locale.TAIWAN)); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_LTR, LocaleUtil.getLayoutDirectionFromLocale(Locale.TRADITIONAL_CHINESE)); Locale locale = new Locale("ar"); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_RTL, LocaleUtil.getLayoutDirectionFromLocale(locale)); locale = new Locale("ar", "AE"); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_RTL, LocaleUtil.getLayoutDirectionFromLocale(locale)); locale = new Locale("ar", "BH"); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_RTL, LocaleUtil.getLayoutDirectionFromLocale(locale)); locale = new Locale("ar", "DZ"); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_RTL, LocaleUtil.getLayoutDirectionFromLocale(locale)); locale = new Locale("ar", "EG"); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_RTL, LocaleUtil.getLayoutDirectionFromLocale(locale)); locale = new Locale("ar", "IQ"); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_RTL, LocaleUtil.getLayoutDirectionFromLocale(locale)); locale = new Locale("ar", "JO"); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_RTL, LocaleUtil.getLayoutDirectionFromLocale(locale)); locale = new Locale("ar", "KW"); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_RTL, LocaleUtil.getLayoutDirectionFromLocale(locale)); locale = new Locale("ar", "LB"); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_RTL, LocaleUtil.getLayoutDirectionFromLocale(locale)); locale = new Locale("ar", "LY"); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_RTL, LocaleUtil.getLayoutDirectionFromLocale(locale)); locale = new Locale("ar", "MA"); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_RTL, LocaleUtil.getLayoutDirectionFromLocale(locale)); locale = new Locale("ar", "OM"); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_RTL, LocaleUtil.getLayoutDirectionFromLocale(locale)); locale = new Locale("ar", "QA"); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_RTL, LocaleUtil.getLayoutDirectionFromLocale(locale)); locale = new Locale("ar", "SA"); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_RTL, LocaleUtil.getLayoutDirectionFromLocale(locale)); locale = new Locale("ar", "SD"); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_RTL, LocaleUtil.getLayoutDirectionFromLocale(locale)); locale = new Locale("ar", "SY"); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_RTL, LocaleUtil.getLayoutDirectionFromLocale(locale)); locale = new Locale("ar", "TN"); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_RTL, LocaleUtil.getLayoutDirectionFromLocale(locale)); locale = new Locale("ar", "YE"); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_RTL, LocaleUtil.getLayoutDirectionFromLocale(locale)); locale = new Locale("fa"); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_RTL, LocaleUtil.getLayoutDirectionFromLocale(locale)); locale = new Locale("fa", "AF"); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_RTL, LocaleUtil.getLayoutDirectionFromLocale(locale)); locale = new Locale("fa", "IR"); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_RTL, LocaleUtil.getLayoutDirectionFromLocale(locale)); locale = new Locale("iw"); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_RTL, LocaleUtil.getLayoutDirectionFromLocale(locale)); locale = new Locale("iw", "IL"); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_RTL, LocaleUtil.getLayoutDirectionFromLocale(locale)); locale = new Locale("he"); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_RTL, LocaleUtil.getLayoutDirectionFromLocale(locale)); locale = new Locale("he", "IL"); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_RTL, LocaleUtil.getLayoutDirectionFromLocale(locale)); locale = new Locale("pa_Arab"); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_RTL, LocaleUtil.getLayoutDirectionFromLocale(locale)); locale = new Locale("pa_Arab", "PK"); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_RTL, LocaleUtil.getLayoutDirectionFromLocale(locale)); locale = new Locale("ps"); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_RTL, LocaleUtil.getLayoutDirectionFromLocale(locale)); locale = new Locale("ps", "AF"); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_RTL, LocaleUtil.getLayoutDirectionFromLocale(locale)); locale = new Locale("ur"); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_RTL, LocaleUtil.getLayoutDirectionFromLocale(locale)); locale = new Locale("ur", "IN"); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_RTL, LocaleUtil.getLayoutDirectionFromLocale(locale)); locale = new Locale("ur", "PK"); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_RTL, LocaleUtil.getLayoutDirectionFromLocale(locale)); locale = new Locale("uz_Arab"); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_RTL, LocaleUtil.getLayoutDirectionFromLocale(locale)); locale = new Locale("uz_Arab", "AF"); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_RTL_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_RTL, LocaleUtil.getLayoutDirectionFromLocale(locale)); // Locale without a real language locale = new Locale("zz"); - assertEquals(LocaleUtil.TEXT_LAYOUT_DIRECTION_LTR_DO_NOT_USE, + assertEquals(LAYOUT_DIRECTION_LTR, LocaleUtil.getLayoutDirectionFromLocale(locale)); } } |