Add test case to check LineBreakWordStyle

After Android T, settings apply phrase-based breaking

Bug: 240462331
Test: robotest
Change-Id: Iaf0f37f0b2eea6a4dcd45582f29b8c37ffea4e38
This commit is contained in:
Edgar Wang
2022-08-25 01:30:51 +08:00
parent 15a8232e38
commit 3f6e1185e0

View File

@@ -16,6 +16,8 @@
package com.android.settingslib.widget;
import static android.graphics.text.LineBreakConfig.LINE_BREAK_WORD_STYLE_PHRASE;
import static com.google.common.truth.Truth.assertThat;
import android.content.Context;
@@ -97,4 +99,14 @@ public class MainSwitchBarTest {
assertThat(mBar.getVisibility()).isEqualTo(View.GONE);
}
@Test
public void setTitle_shouldSetCorrectLineBreakStyle() {
final String title = "title";
mBar.setTitle(title);
final TextView textView = ((TextView) mBar.findViewById(R.id.switch_text));
assertThat(textView.getLineBreakWordStyle()).isEqualTo(LINE_BREAK_WORD_STYLE_PHRASE);
}
}