Skip to content

Commit b72c7e7

Browse files
raajkumarsdsn5ft
authored andcommitted
Updated MaterialTextView unit tests to use AppCompat theme.
PiperOrigin-RevId: 275034760
1 parent 3a21a88 commit b72c7e7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/javatests/com/google/android/material/textview/MaterialTextViewTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public void ensureThatCreatedViewUsesLineHeightFromThemeAttribute() {
6363

6464
@Test
6565
public void ensureThatCreatedViewUsesLineHeightFromTextAppearance() {
66+
context.setTheme(R.style.Theme_AppCompat);
6667
MaterialTextView textView =
6768
(MaterialTextView)
6869
inflater.inflate(R.layout.text_view_with_line_height_from_appearance, null, false);
@@ -71,6 +72,7 @@ public void ensureThatCreatedViewUsesLineHeightFromTextAppearance() {
7172

7273
@Test
7374
public void ensureThatCreatedViewUsesLineHeightFromStyleWithTextAppearance() {
75+
context.setTheme(R.style.Theme_AppCompat);
7476
MaterialTextView textView =
7577
(MaterialTextView)
7678
inflater.inflate(R.layout.text_view_with_line_height_from_style, null, false);
@@ -79,6 +81,7 @@ public void ensureThatCreatedViewUsesLineHeightFromStyleWithTextAppearance() {
7981

8082
@Test
8183
public void ensureThatLineHeightFromLayoutOverridesThatFromTextAppearance() {
84+
context.setTheme(R.style.Theme_AppCompat);
8285
MaterialTextView textView =
8386
(MaterialTextView)
8487
inflater.inflate(R.layout.text_view_with_line_height_from_layout, null, false);
@@ -87,6 +90,7 @@ public void ensureThatLineHeightFromLayoutOverridesThatFromTextAppearance() {
8790

8891
@Test
8992
public void ensureThatViewAppliesLineHeightWhenSettingTextAppearance() {
93+
context.setTheme(R.style.Theme_AppCompat);
9094
MaterialTextView textView = new MaterialTextView(context);
9195
textView.setTextAppearance(context, R.style.TestStyleWithLineHeight);
9296
assertThat(textView.getLineHeight()).isEqualTo(testLineHeight);

0 commit comments

Comments
 (0)