Search in sources :

Example 36 with LocaleData

use of libcore.icu.LocaleData in project robolectric by robolectric.

the class ShadowLocaleDataTest method shouldSupportLocaleEn_US_percentPost22.

@Test
@Config(minSdk = LOLLIPOP_MR1)
public void shouldSupportLocaleEn_US_percentPost22() {
    LocaleData localeData = LocaleData.get(Locale.US);
    assertThat(localeData.percent).isEqualTo("%");
}
Also used : LocaleData(libcore.icu.LocaleData) Test(org.junit.Test) Config(org.robolectric.annotation.Config)

Example 37 with LocaleData

use of libcore.icu.LocaleData in project robolectric by robolectric.

the class ShadowLocaleDataTest method shouldDefaultToTheDefaultLocale.

@Test
public void shouldDefaultToTheDefaultLocale() {
    Locale.setDefault(Locale.US);
    LocaleData localeData = LocaleData.get(null);
    assertThat(localeData.amPm).isEqualTo(new String[] { "AM", "PM" });
}
Also used : LocaleData(libcore.icu.LocaleData) Test(org.junit.Test)

Example 38 with LocaleData

use of libcore.icu.LocaleData in project j2objc by google.

the class LocaleDataTest method test_en_US.

public void test_en_US() throws Exception {
    LocaleData l = LocaleData.get(Locale.US);
    assertEquals("AM", l.amPm[0]);
    // narrowAm not available in J2ObjC.
    // assertEquals("a", l.narrowAm);
    assertEquals("BC", l.eras[0]);
    assertEquals("January", l.longMonthNames[0]);
    assertEquals("Jan", l.shortMonthNames[0]);
    assertEquals("J", l.tinyMonthNames[0]);
    assertEquals("January", l.longStandAloneMonthNames[0]);
    assertEquals("Jan", l.shortStandAloneMonthNames[0]);
    assertEquals("J", l.tinyStandAloneMonthNames[0]);
    assertEquals("Sunday", l.longWeekdayNames[1]);
    assertEquals("Sun", l.shortWeekdayNames[1]);
    assertEquals("S", l.tinyWeekdayNames[1]);
    assertEquals("Sunday", l.longStandAloneWeekdayNames[1]);
    assertEquals("Sun", l.shortStandAloneWeekdayNames[1]);
    assertEquals("S", l.tinyStandAloneWeekdayNames[1]);
    assertEquals("Yesterday", l.yesterday);
    assertEquals("Today", l.today);
    assertEquals("Tomorrow", l.tomorrow);
}
Also used : LocaleData(libcore.icu.LocaleData)

Example 39 with LocaleData

use of libcore.icu.LocaleData in project j2objc by google.

the class LocaleDataTest method test_ko_KR.

public void test_ko_KR() throws Exception {
    LocaleData l = LocaleData.get(new Locale("ko", "KR"));
    // Ensure the fix for http://b/14493853 doesn't mangle Hangul.
    assertEquals("어제", l.yesterday);
    assertEquals("오늘", l.today);
    assertEquals("내일", l.tomorrow);
}
Also used : Locale(java.util.Locale) LocaleData(libcore.icu.LocaleData)

Example 40 with LocaleData

use of libcore.icu.LocaleData in project j2objc by google.

the class LocaleDataTest method test_de_DE.

public void test_de_DE() throws Exception {
    LocaleData l = LocaleData.get(new Locale("de", "DE"));
    assertEquals("Gestern", l.yesterday);
    assertEquals("Heute", l.today);
    assertEquals("Morgen", l.tomorrow);
}
Also used : Locale(java.util.Locale) LocaleData(libcore.icu.LocaleData)

Aggregations

LocaleData (libcore.icu.LocaleData)78 SpannableStringBuilder (android.text.SpannableStringBuilder)12 Locale (java.util.Locale)11 Test (org.junit.Test)8 Context (android.content.Context)6 Spanned (android.text.Spanned)6 SpannedString (android.text.SpannedString)6 CharacterStyle (android.text.style.CharacterStyle)6 RelativeSizeSpan (android.text.style.RelativeSizeSpan)6 SimpleDateFormat (java.text.SimpleDateFormat)6 Config (org.robolectric.annotation.Config)6 Date (java.util.Date)3 Resources (android.content.res.Resources)1 Implementation (org.robolectric.annotation.Implementation)1