Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2007 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package android.util; |
| 18 | |
| 19 | import java.util.Locale; |
| 20 | |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 21 | import android.test.AndroidTestCase; |
| 22 | import dalvik.annotation.TestLevel; |
| 23 | import dalvik.annotation.TestTargetNew; |
| 24 | |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 25 | import static android.view.View.LAYOUT_DIRECTION_LTR; |
| 26 | import static android.view.View.LAYOUT_DIRECTION_RTL; |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 27 | |
| 28 | public class LocaleUtilTest extends AndroidTestCase { |
| 29 | |
| 30 | @TestTargetNew( |
| 31 | level = TestLevel.COMPLETE, |
| 32 | method = "getLayoutDirectionFromLocale", |
| 33 | args = {Locale.class} |
| 34 | ) |
| 35 | public void testGetLayoutDirectionFromLocale() { |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 36 | assertEquals(LAYOUT_DIRECTION_LTR, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 37 | LocaleUtil.getLayoutDirectionFromLocale(null)); |
| 38 | |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 39 | assertEquals(LAYOUT_DIRECTION_LTR, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 40 | LocaleUtil.getLayoutDirectionFromLocale(Locale.ENGLISH)); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 41 | assertEquals(LAYOUT_DIRECTION_LTR, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 42 | LocaleUtil.getLayoutDirectionFromLocale(Locale.CANADA)); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 43 | assertEquals(LAYOUT_DIRECTION_LTR, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 44 | LocaleUtil.getLayoutDirectionFromLocale(Locale.CANADA_FRENCH)); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 45 | assertEquals(LAYOUT_DIRECTION_LTR, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 46 | LocaleUtil.getLayoutDirectionFromLocale(Locale.FRANCE)); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 47 | assertEquals(LAYOUT_DIRECTION_LTR, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 48 | LocaleUtil.getLayoutDirectionFromLocale(Locale.FRENCH)); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 49 | assertEquals(LAYOUT_DIRECTION_LTR, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 50 | LocaleUtil.getLayoutDirectionFromLocale(Locale.GERMAN)); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 51 | assertEquals(LAYOUT_DIRECTION_LTR, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 52 | LocaleUtil.getLayoutDirectionFromLocale(Locale.GERMANY)); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 53 | assertEquals(LAYOUT_DIRECTION_LTR, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 54 | LocaleUtil.getLayoutDirectionFromLocale(Locale.ITALIAN)); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 55 | assertEquals(LAYOUT_DIRECTION_LTR, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 56 | LocaleUtil.getLayoutDirectionFromLocale(Locale.ITALY)); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 57 | assertEquals(LAYOUT_DIRECTION_LTR, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 58 | LocaleUtil.getLayoutDirectionFromLocale(Locale.UK)); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 59 | assertEquals(LAYOUT_DIRECTION_LTR, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 60 | LocaleUtil.getLayoutDirectionFromLocale(Locale.US)); |
| 61 | |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 62 | assertEquals(LAYOUT_DIRECTION_LTR, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 63 | LocaleUtil.getLayoutDirectionFromLocale(Locale.ROOT)); |
| 64 | |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 65 | assertEquals(LAYOUT_DIRECTION_LTR, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 66 | LocaleUtil.getLayoutDirectionFromLocale(Locale.CHINA)); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 67 | assertEquals(LAYOUT_DIRECTION_LTR, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 68 | LocaleUtil.getLayoutDirectionFromLocale(Locale.CHINESE)); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 69 | assertEquals(LAYOUT_DIRECTION_LTR, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 70 | LocaleUtil.getLayoutDirectionFromLocale(Locale.JAPAN)); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 71 | assertEquals(LAYOUT_DIRECTION_LTR, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 72 | LocaleUtil.getLayoutDirectionFromLocale(Locale.JAPANESE)); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 73 | assertEquals(LAYOUT_DIRECTION_LTR, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 74 | LocaleUtil.getLayoutDirectionFromLocale(Locale.KOREA)); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 75 | assertEquals(LAYOUT_DIRECTION_LTR, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 76 | LocaleUtil.getLayoutDirectionFromLocale(Locale.KOREAN)); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 77 | assertEquals(LAYOUT_DIRECTION_LTR, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 78 | LocaleUtil.getLayoutDirectionFromLocale(Locale.PRC)); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 79 | assertEquals(LAYOUT_DIRECTION_LTR, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 80 | LocaleUtil.getLayoutDirectionFromLocale(Locale.SIMPLIFIED_CHINESE)); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 81 | assertEquals(LAYOUT_DIRECTION_LTR, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 82 | LocaleUtil.getLayoutDirectionFromLocale(Locale.TAIWAN)); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 83 | assertEquals(LAYOUT_DIRECTION_LTR, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 84 | LocaleUtil.getLayoutDirectionFromLocale(Locale.TRADITIONAL_CHINESE)); |
| 85 | |
| 86 | Locale locale = new Locale("ar"); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 87 | assertEquals(LAYOUT_DIRECTION_RTL, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 88 | LocaleUtil.getLayoutDirectionFromLocale(locale)); |
| 89 | locale = new Locale("ar", "AE"); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 90 | assertEquals(LAYOUT_DIRECTION_RTL, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 91 | LocaleUtil.getLayoutDirectionFromLocale(locale)); |
| 92 | locale = new Locale("ar", "BH"); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 93 | assertEquals(LAYOUT_DIRECTION_RTL, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 94 | LocaleUtil.getLayoutDirectionFromLocale(locale)); |
| 95 | locale = new Locale("ar", "DZ"); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 96 | assertEquals(LAYOUT_DIRECTION_RTL, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 97 | LocaleUtil.getLayoutDirectionFromLocale(locale)); |
| 98 | locale = new Locale("ar", "EG"); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 99 | assertEquals(LAYOUT_DIRECTION_RTL, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 100 | LocaleUtil.getLayoutDirectionFromLocale(locale)); |
| 101 | locale = new Locale("ar", "IQ"); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 102 | assertEquals(LAYOUT_DIRECTION_RTL, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 103 | LocaleUtil.getLayoutDirectionFromLocale(locale)); |
| 104 | locale = new Locale("ar", "JO"); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 105 | assertEquals(LAYOUT_DIRECTION_RTL, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 106 | LocaleUtil.getLayoutDirectionFromLocale(locale)); |
| 107 | locale = new Locale("ar", "KW"); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 108 | assertEquals(LAYOUT_DIRECTION_RTL, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 109 | LocaleUtil.getLayoutDirectionFromLocale(locale)); |
| 110 | locale = new Locale("ar", "LB"); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 111 | assertEquals(LAYOUT_DIRECTION_RTL, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 112 | LocaleUtil.getLayoutDirectionFromLocale(locale)); |
| 113 | locale = new Locale("ar", "LY"); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 114 | assertEquals(LAYOUT_DIRECTION_RTL, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 115 | LocaleUtil.getLayoutDirectionFromLocale(locale)); |
| 116 | locale = new Locale("ar", "MA"); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 117 | assertEquals(LAYOUT_DIRECTION_RTL, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 118 | LocaleUtil.getLayoutDirectionFromLocale(locale)); |
| 119 | locale = new Locale("ar", "OM"); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 120 | assertEquals(LAYOUT_DIRECTION_RTL, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 121 | LocaleUtil.getLayoutDirectionFromLocale(locale)); |
| 122 | locale = new Locale("ar", "QA"); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 123 | assertEquals(LAYOUT_DIRECTION_RTL, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 124 | LocaleUtil.getLayoutDirectionFromLocale(locale)); |
| 125 | locale = new Locale("ar", "SA"); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 126 | assertEquals(LAYOUT_DIRECTION_RTL, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 127 | LocaleUtil.getLayoutDirectionFromLocale(locale)); |
| 128 | locale = new Locale("ar", "SD"); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 129 | assertEquals(LAYOUT_DIRECTION_RTL, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 130 | LocaleUtil.getLayoutDirectionFromLocale(locale)); |
| 131 | locale = new Locale("ar", "SY"); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 132 | assertEquals(LAYOUT_DIRECTION_RTL, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 133 | LocaleUtil.getLayoutDirectionFromLocale(locale)); |
| 134 | locale = new Locale("ar", "TN"); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 135 | assertEquals(LAYOUT_DIRECTION_RTL, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 136 | LocaleUtil.getLayoutDirectionFromLocale(locale)); |
| 137 | locale = new Locale("ar", "YE"); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 138 | assertEquals(LAYOUT_DIRECTION_RTL, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 139 | LocaleUtil.getLayoutDirectionFromLocale(locale)); |
| 140 | |
| 141 | locale = new Locale("fa"); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 142 | assertEquals(LAYOUT_DIRECTION_RTL, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 143 | LocaleUtil.getLayoutDirectionFromLocale(locale)); |
| 144 | locale = new Locale("fa", "AF"); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 145 | assertEquals(LAYOUT_DIRECTION_RTL, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 146 | LocaleUtil.getLayoutDirectionFromLocale(locale)); |
| 147 | locale = new Locale("fa", "IR"); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 148 | assertEquals(LAYOUT_DIRECTION_RTL, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 149 | LocaleUtil.getLayoutDirectionFromLocale(locale)); |
| 150 | |
| 151 | locale = new Locale("iw"); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 152 | assertEquals(LAYOUT_DIRECTION_RTL, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 153 | LocaleUtil.getLayoutDirectionFromLocale(locale)); |
| 154 | locale = new Locale("iw", "IL"); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 155 | assertEquals(LAYOUT_DIRECTION_RTL, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 156 | LocaleUtil.getLayoutDirectionFromLocale(locale)); |
| 157 | locale = new Locale("he"); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 158 | assertEquals(LAYOUT_DIRECTION_RTL, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 159 | LocaleUtil.getLayoutDirectionFromLocale(locale)); |
| 160 | locale = new Locale("he", "IL"); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 161 | assertEquals(LAYOUT_DIRECTION_RTL, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 162 | LocaleUtil.getLayoutDirectionFromLocale(locale)); |
| 163 | |
| 164 | locale = new Locale("pa_Arab"); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 165 | assertEquals(LAYOUT_DIRECTION_RTL, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 166 | LocaleUtil.getLayoutDirectionFromLocale(locale)); |
| 167 | locale = new Locale("pa_Arab", "PK"); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 168 | assertEquals(LAYOUT_DIRECTION_RTL, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 169 | LocaleUtil.getLayoutDirectionFromLocale(locale)); |
| 170 | |
| 171 | locale = new Locale("ps"); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 172 | assertEquals(LAYOUT_DIRECTION_RTL, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 173 | LocaleUtil.getLayoutDirectionFromLocale(locale)); |
| 174 | locale = new Locale("ps", "AF"); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 175 | assertEquals(LAYOUT_DIRECTION_RTL, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 176 | LocaleUtil.getLayoutDirectionFromLocale(locale)); |
| 177 | |
| 178 | locale = new Locale("ur"); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 179 | assertEquals(LAYOUT_DIRECTION_RTL, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 180 | LocaleUtil.getLayoutDirectionFromLocale(locale)); |
| 181 | locale = new Locale("ur", "IN"); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 182 | assertEquals(LAYOUT_DIRECTION_RTL, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 183 | LocaleUtil.getLayoutDirectionFromLocale(locale)); |
| 184 | locale = new Locale("ur", "PK"); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 185 | assertEquals(LAYOUT_DIRECTION_RTL, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 186 | LocaleUtil.getLayoutDirectionFromLocale(locale)); |
| 187 | |
| 188 | locale = new Locale("uz_Arab"); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 189 | assertEquals(LAYOUT_DIRECTION_RTL, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 190 | LocaleUtil.getLayoutDirectionFromLocale(locale)); |
| 191 | locale = new Locale("uz_Arab", "AF"); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 192 | assertEquals(LAYOUT_DIRECTION_RTL, |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 193 | LocaleUtil.getLayoutDirectionFromLocale(locale)); |
Kenny Root | 49e3b37 | 2011-06-16 02:25:35 -0700 | [diff] [blame] | 194 | |
| 195 | // Locale without a real language |
| 196 | locale = new Locale("zz"); |
Fabrice Di Meglio | 3fb824b | 2012-02-28 17:58:31 -0800 | [diff] [blame] | 197 | assertEquals(LAYOUT_DIRECTION_LTR, |
Kenny Root | 49e3b37 | 2011-06-16 02:25:35 -0700 | [diff] [blame] | 198 | LocaleUtil.getLayoutDirectionFromLocale(locale)); |
Fabrice Di Meglio | a47f45e | 2011-06-15 14:22:12 -0700 | [diff] [blame] | 199 | } |
| 200 | } |