@Test public void createFromAsset_shouldCreateTypeface() { Typeface typeface = Typeface.createFromAsset( ApplicationProvider.getApplicationContext().getAssets(), "myFont.ttf"); assertThat(typeface.getStyle()).isEqualTo(Typeface.NORMAL); assertThat(shadowOf(typeface).getFontDescription().getFamilyName()).isEqualTo("myFont.ttf"); assertThat(shadowOf(typeface).getFontDescription().getStyle()).isEqualTo(Typeface.NORMAL); }
@Test public void createFromFile_withPath_shouldCreateTypeface() { Typeface typeface = Typeface.createFromFile(fontFile.getPath()); assertThat(typeface.getStyle()).isEqualTo(Typeface.NORMAL); assertThat(shadowOf(typeface).getFontDescription().getFamilyName()).isEqualTo("myFont.ttf"); assertThat(shadowOf(typeface).getFontDescription().getStyle()).isEqualTo(Typeface.NORMAL); }
@Test public void create_withoutFamily_shouldCreateTypeface() { Typeface typeface = Typeface.create((Typeface) null, Typeface.ITALIC); assertThat(typeface.getStyle()).isEqualTo(Typeface.ITALIC); assertThat(shadowOf(typeface).getFontDescription().getFamilyName()).isEqualTo(null); assertThat(shadowOf(typeface).getFontDescription().getStyle()).isEqualTo(Typeface.ITALIC); }
@Implementation public int getStyle() { return description.getStyle(); }
@Implementation public int getStyle() { return description.getStyle(); }
@Implementation public int getStyle() { return description.getStyle(); }
@Implementation protected int getStyle() { return description.getStyle(); }
@Test public void create_withFamily_shouldCreateTypeface() { Typeface typeface = Typeface.create(Typeface.create("roboto", Typeface.BOLD), Typeface.ITALIC); assertThat(typeface.getStyle()).isEqualTo(Typeface.ITALIC); assertThat(shadowOf(typeface).getFontDescription().getFamilyName()).isEqualTo("roboto"); assertThat(shadowOf(typeface).getFontDescription().getStyle()).isEqualTo(Typeface.ITALIC); }
@Implementation protected int getStyle() { return description.getStyle(); }
@Test public void create_withFamilyName_shouldCreateTypeface() { Typeface typeface = Typeface.create("roboto", Typeface.BOLD); assertThat(typeface.getStyle()).isEqualTo(Typeface.BOLD); assertThat(shadowOf(typeface).getFontDescription().getFamilyName()).isEqualTo("roboto"); assertThat(shadowOf(typeface).getFontDescription().getStyle()).isEqualTo(Typeface.BOLD); }