Search in sources :

Example 76 with LocaleData

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

the class ShadowLocaleDataTest method shouldSupportLocaleEn_US_perMillPostP.

@Test
@Config(minSdk = Build.VERSION_CODES.P)
public void shouldSupportLocaleEn_US_perMillPostP() {
    LocaleData localeData = LocaleData.get(Locale.US);
    assertThat(localeData.perMill).isEqualTo("‰");
}
Also used : LocaleData(libcore.icu.LocaleData) Test(org.junit.Test) Config(org.robolectric.annotation.Config)

Example 77 with LocaleData

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

the class ShadowLocaleDataTest method shouldSupportLocaleEn_US_since_jelly_bean_mr1.

@Test
@Config(minSdk = JELLY_BEAN_MR1)
public void shouldSupportLocaleEn_US_since_jelly_bean_mr1() throws NoSuchFieldException, IllegalAccessException {
    LocaleData localeData = LocaleData.get(Locale.US);
    assertThat(localeData.tinyMonthNames).isEqualTo(new String[] { "J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D" });
    assertThat(localeData.tinyStandAloneMonthNames).isEqualTo(localeData.tinyMonthNames);
    assertThat(localeData.tinyWeekdayNames).isEqualTo(new String[] { "", "S", "M", "T", "W", "T", "F", "S" });
    assertThat(localeData.tinyStandAloneWeekdayNames).isEqualTo(localeData.tinyWeekdayNames);
    if (getApiLevel() <= R) {
        assertThat((String) ReflectionHelpers.getField(localeData, "yesterday")).isEqualTo("Yesterday");
    }
    assertThat(localeData.today).isEqualTo("Today");
    assertThat(localeData.tomorrow).isEqualTo("Tomorrow");
}
Also used : LocaleData(libcore.icu.LocaleData) Test(org.junit.Test) Config(org.robolectric.annotation.Config)

Example 78 with LocaleData

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

the class ShadowLocaleDataTest method shouldSupportLocaleEn_US_perMill.

@Test
@Config(maxSdk = Build.VERSION_CODES.O)
public void shouldSupportLocaleEn_US_perMill() {
    LocaleData localeData = LocaleData.get(Locale.US);
    char perMillValue = ReflectionHelpers.getField(localeData, "perMill");
    assertThat(perMillValue).isEqualTo('‰');
}
Also used : LocaleData(libcore.icu.LocaleData) Test(org.junit.Test) Config(org.robolectric.annotation.Config)

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