mirror of
https://github.com/samsonjs/media.git
synced 2026-04-04 11:05:47 +00:00
Fix typo in SpannedSubject.hasBoldItalicSpanBetween
PiperOrigin-RevId: 288710939
This commit is contained in:
parent
fa9bf9c828
commit
e5eaacec20
2 changed files with 19 additions and 2 deletions
|
|
@ -167,8 +167,8 @@ public final class SpannedSubject extends Subject {
|
|||
simpleFact(
|
||||
String.format("No matching StyleSpans found between start=%s,end=%s", start, end)),
|
||||
fact("in text", actual.toString()),
|
||||
fact("expected either styles", Arrays.asList(Typeface.BOLD_ITALIC)),
|
||||
fact("or styles", Arrays.asList(Typeface.BOLD, Typeface.BOLD_ITALIC)),
|
||||
fact("expected either styles", Collections.singletonList(Typeface.BOLD_ITALIC)),
|
||||
fact("or styles", Arrays.asList(Typeface.BOLD, Typeface.ITALIC)),
|
||||
fact("but found styles", styles));
|
||||
return ALREADY_FAILED_WITH_FLAGS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -151,6 +151,23 @@ public class SpannedSubjectTest {
|
|||
.withFlags(Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void boldItalicSpan_onlyItalic() {
|
||||
SpannableString spannable = SpannableString.valueOf("test with italic section");
|
||||
int start = "test with ".length();
|
||||
int end = start + "italic".length();
|
||||
spannable.setSpan(new StyleSpan(Typeface.ITALIC), start, end, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
|
||||
AssertionError expected =
|
||||
expectFailure(
|
||||
whenTesting -> whenTesting.that(spannable).hasBoldItalicSpanBetween(start, end));
|
||||
assertThat(expected)
|
||||
.factKeys()
|
||||
.contains(
|
||||
String.format("No matching StyleSpans found between start=%s,end=%s", start, end));
|
||||
assertThat(expected).factValue("but found styles").contains("[" + Typeface.ITALIC + "]");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void boldItalicSpan_mismatchedStartIndex() {
|
||||
SpannableString spannable = SpannableString.valueOf("test with bold & italic section");
|
||||
|
|
|
|||
Loading…
Reference in a new issue