Skip to content

Commit

Permalink
AbsStyleSpan test
Browse files Browse the repository at this point in the history
  • Loading branch information
fabOnReact committed Jan 24, 2023
1 parent e702a5d commit 941a37b
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@
@RunWith(RobolectricTestRunner.class)
@PowerMockIgnore({"org.mockito.*", "org.robolectric.*", "androidx.*", "android.*"})
public class CustomLineHeightSpanTest {
@Test
public void absoluteSizeSpanChangesFontSize() {
AbsoluteSizeSpan absoluteSizeSpan = new AbsoluteSizeSpan(25);
assertThat(absoluteSizeSpan.getSize()).isEqualTo(25);
}

@Test
public void evenLineHeightShouldIncreaseAllMetricsProportionally() {
AbsoluteSizeSpan absoluteSizeSpan = new AbsoluteSizeSpan(25);
CustomLineHeightSpan customLineHeightSpan = new CustomLineHeightSpan(22);
Paint.FontMetricsInt fm = new Paint.FontMetricsInt();
fm.top = -10;
Expand All @@ -31,7 +35,6 @@ public void evenLineHeightShouldIncreaseAllMetricsProportionally() {
fm.bottom = 10;
customLineHeightSpan.chooseHeight("Hi", 0, 2, 0, 0, fm);
// Since line height is even it should be equally added to top and bottom.
assertThat(absoluteSizeSpan.getSize()).isEqualTo(25);
assertThat(fm.top).isEqualTo(-11);
assertThat(fm.ascent).isEqualTo(-11);
assertThat(fm.descent).isEqualTo(11);
Expand Down

0 comments on commit 941a37b

Please sign in to comment.