SpannedSubject
@UnstableApi
public final class SpannedSubject extends Subject
| java.lang.Object | ||
| ↳ | com.google.common.truth.Subject | |
| ↳ | androidx.media3.test.utils.truth.SpannedSubject |
A Truth Subject for assertions on Spanned instances containing text styling.
Summary
Nested types |
|---|
public interface SpannedSubject.AbsoluteSizedAllows assertions about the absolute size of a span. |
public interface SpannedSubject.AlignedAllows assertions about the alignment of a span. |
public interface SpannedSubject.AndSpanFlagsAllows additional assertions to be made on the flags of matching spans. |
public interface SpannedSubject.ColoredAllows assertions about the color of a span. |
public interface SpannedSubject.EmphasizedTextAllows assertions about a span's text emphasis mark and its position. |
public interface SpannedSubject.RelativeSizedAllows assertions about the relative size of a span. |
public interface SpannedSubject.RubyTextAllows assertions about a span's ruby text and its position. |
public interface SpannedSubject.TypefacedAllows assertions about the typeface of a span. |
public interface SpannedSubject.VoiceTextAllows assertions about a span's voice its position. |
public interface SpannedSubject.WithSpanFlagsAllows additional assertions to be made on the flags of matching spans. |
Public methods |
|
|---|---|
static SpannedSubject |
assertThat(@Nullable Spanned spanned)Convenience method to create a SpannedSubject. |
SpannedSubject.AbsoluteSized |
hasAbsoluteSizeSpanBetween(int start, int end)Checks that the subject has a |
SpannedSubject.Aligned |
hasAlignmentSpanBetween(int start, int end)Checks that the subject has a |
SpannedSubject.Colored |
hasBackgroundColorSpanBetween(int start, int end)Checks that the subject has a |
SpannedSubject.WithSpanFlags |
hasBoldItalicSpanBetween(int start, int end)Checks that the subject has bold and italic styling from |
SpannedSubject.WithSpanFlags |
hasBoldSpanBetween(int start, int end)Checks that the subject has a bold span from |
SpannedSubject.Colored |
hasForegroundColorSpanBetween(int start, int end)Checks that the subject has a |
SpannedSubject.WithSpanFlags |
hasHorizontalTextInVerticalContextSpanBetween(int start, int end)Checks that the subject has an |
SpannedSubject.WithSpanFlags |
hasItalicSpanBetween(int start, int end)Checks that the subject has an italic span from |
void |
hasNoAbsoluteSizeSpanBetween(int start, int end)Checks that the subject has no |
void |
hasNoAlignmentSpanBetween(int start, int end)Checks that the subject has no |
void |
hasNoBackgroundColorSpanBetween(int start, int end)Checks that the subject has no |
void |
hasNoForegroundColorSpanBetween(int start, int end)Checks that the subject has no |
void |
hasNoHorizontalTextInVerticalContextSpanBetween(int start, int end)Checks that the subject has no |
void |
hasNoRelativeSizeSpanBetween(int start, int end)Checks that the subject has no |
void |
hasNoRubySpanBetween(int start, int end)Checks that the subject has no |
void |
|
void |
hasNoStrikethroughSpanBetween(int start, int end)Checks that the subject has no |
void |
hasNoStyleSpanBetween(int start, int end)Checks that the subject has no |
void |
hasNoTextEmphasisSpanBetween(int start, int end)Checks that the subject has no |
void |
hasNoTypefaceSpanBetween(int start, int end)Checks that the subject has no |
void |
hasNoUnderlineSpanBetween(int start, int end)Checks that the subject has no |
void |
hasNoVoiceSpanBetween(int start, int end)Checks that the subject has no |
SpannedSubject.RelativeSized |
hasRelativeSizeSpanBetween(int start, int end)Checks that the subject has a |
SpannedSubject.RubyText |
hasRubySpanBetween(int start, int end)Checks that the subject has a |
SpannedSubject.WithSpanFlags |
hasStrikethroughSpanBetween(int start, int end)Checks that the subject has an |
SpannedSubject.EmphasizedText |
hasTextEmphasisSpanBetween(int start, int end)Checks that the subject has an |
SpannedSubject.Typefaced |
hasTypefaceSpanBetween(int start, int end)Checks that the subject has a |
SpannedSubject.WithSpanFlags |
hasUnderlineSpanBetween(int start, int end)Checks that the subject has an |
SpannedSubject.VoiceText |
hasVoiceSpanBetween(int start, int end)Checks that the subject has an |
static Subject.Factory<SpannedSubject, Spanned> |
spanned() |
Inherited methods |
||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Public methods
assertThat
public static SpannedSubject assertThat(@Nullable Spanned spanned)
Convenience method to create a SpannedSubject.
Can be statically imported alongside other Truth assertThat methods.
| Returns | |
|---|---|
SpannedSubject |
An object for conducting assertions on the subject. |
hasAbsoluteSizeSpanBetween
public SpannedSubject.AbsoluteSized hasAbsoluteSizeSpanBetween(int start, int end)
Checks that the subject has a AbsoluteSizeSpan from start to end.
The size is asserted in a follow-up method call on the return AbsoluteSized object.
| Parameters | |
|---|---|
int start |
The start of the expected span. |
int end |
The end of the expected span. |
| Returns | |
|---|---|
SpannedSubject.AbsoluteSized |
A |
hasAlignmentSpanBetween
public SpannedSubject.Aligned hasAlignmentSpanBetween(int start, int end)
Checks that the subject has a AlignmentSpan from start to end.
The alignment is asserted in a follow-up method call on the return Aligned object.
| Parameters | |
|---|---|
int start |
The start of the expected span. |
int end |
The end of the expected span. |
| Returns | |
|---|---|
SpannedSubject.Aligned |
A |
hasBackgroundColorSpanBetween
public SpannedSubject.Colored hasBackgroundColorSpanBetween(int start, int end)
Checks that the subject has a BackgroundColorSpan from start to end.
The color is asserted in a follow-up method call on the return Colored object.
| Parameters | |
|---|---|
int start |
The start of the expected span. |
int end |
The end of the expected span. |
| Returns | |
|---|---|
SpannedSubject.Colored |
A |
hasBoldItalicSpanBetween
public SpannedSubject.WithSpanFlags hasBoldItalicSpanBetween(int start, int end)
Checks that the subject has bold and italic styling from start to end.
This can either be:
- A single
StyleSpanwithspan.getStyle() == Typeface.BOLD_ITALIC. - Two
StyleSpans, one withspan.getStyle() == Typeface.BOLDand the other withspan.getStyle() == Typeface.ITALIC.
| Parameters | |
|---|---|
int start |
The start of the expected span. |
int end |
The end of the expected span. |
| Returns | |
|---|---|
SpannedSubject.WithSpanFlags |
A |
hasBoldSpanBetween
public SpannedSubject.WithSpanFlags hasBoldSpanBetween(int start, int end)
Checks that the subject has a bold span from start to end.
| Parameters | |
|---|---|
int start |
The start of the expected span. |
int end |
The end of the expected span. |
| Returns | |
|---|---|
SpannedSubject.WithSpanFlags |
A |
hasForegroundColorSpanBetween
public SpannedSubject.Colored hasForegroundColorSpanBetween(int start, int end)
Checks that the subject has a ForegroundColorSpan from start to end.
The color is asserted in a follow-up method call on the return Colored object.
| Parameters | |
|---|---|
int start |
The start of the expected span. |
int end |
The end of the expected span. |
| Returns | |
|---|---|
SpannedSubject.Colored |
A |
hasHorizontalTextInVerticalContextSpanBetween
public SpannedSubject.WithSpanFlags hasHorizontalTextInVerticalContextSpanBetween(int start, int end)
Checks that the subject has an HorizontalTextInVerticalContextSpan from start to end.
| Parameters | |
|---|---|
int start |
The start of the expected span. |
int end |
The end of the expected span. |
| Returns | |
|---|---|
SpannedSubject.WithSpanFlags |
A |
hasItalicSpanBetween
public SpannedSubject.WithSpanFlags hasItalicSpanBetween(int start, int end)
Checks that the subject has an italic span from start to end.
| Parameters | |
|---|---|
int start |
The start of the expected span. |
int end |
The end of the expected span. |
| Returns | |
|---|---|
SpannedSubject.WithSpanFlags |
A |
hasNoAbsoluteSizeSpanBetween
public void hasNoAbsoluteSizeSpanBetween(int start, int end)
Checks that the subject has no AbsoluteSizeSpans on any of the text between
start and end.
This fails even if the start and end indexes don't exactly match.
| Parameters | |
|---|---|
int start |
The start index to start searching for spans. |
int end |
The end index to stop searching for spans. |
hasNoAlignmentSpanBetween
public void hasNoAlignmentSpanBetween(int start, int end)
Checks that the subject has no AlignmentSpans on any of the text between start and end.
This fails even if the start and end indexes don't exactly match.
| Parameters | |
|---|---|
int start |
The start index to start searching for spans. |
int end |
The end index to stop searching for spans. |
hasNoBackgroundColorSpanBetween
public void hasNoBackgroundColorSpanBetween(int start, int end)
Checks that the subject has no BackgroundColorSpans on any of the text between
start and end.
This fails even if the start and end indexes don't exactly match.
| Parameters | |
|---|---|
int start |
The start index to start searching for spans. |
int end |
The end index to stop searching for spans. |
hasNoForegroundColorSpanBetween
public void hasNoForegroundColorSpanBetween(int start, int end)
Checks that the subject has no ForegroundColorSpans on any of the text between
start and end.
This fails even if the start and end indexes don't exactly match.
| Parameters | |
|---|---|
int start |
The start index to start searching for spans. |
int end |
The end index to stop searching for spans. |
hasNoHorizontalTextInVerticalContextSpanBetween
public void hasNoHorizontalTextInVerticalContextSpanBetween(int start, int end)
Checks that the subject has no HorizontalTextInVerticalContextSpans on any of the text between start and end.
This fails even if the start and end indexes don't exactly match.
| Parameters | |
|---|---|
int start |
The start index to start searching for spans. |
int end |
The end index to stop searching for spans. |
hasNoRelativeSizeSpanBetween
public void hasNoRelativeSizeSpanBetween(int start, int end)
Checks that the subject has no RelativeSizeSpans on any of the text between
start and end.
This fails even if the start and end indexes don't exactly match.
| Parameters | |
|---|---|
int start |
The start index to start searching for spans. |
int end |
The end index to stop searching for spans. |
hasNoRubySpanBetween
public void hasNoRubySpanBetween(int start, int end)
Checks that the subject has no RubySpans on any of the text between start and end.
This fails even if the start and end indexes don't exactly match.
| Parameters | |
|---|---|
int start |
The start index to start searching for spans. |
int end |
The end index to stop searching for spans. |
hasNoStrikethroughSpanBetween
public void hasNoStrikethroughSpanBetween(int start, int end)
Checks that the subject has no StrikethroughSpans on any of the text between
start and end.
This fails even if the start and end indexes don't exactly match.
| Parameters | |
|---|---|
int start |
The start index to start searching for spans. |
int end |
The end index to stop searching for spans. |
hasNoStyleSpanBetween
public void hasNoStyleSpanBetween(int start, int end)
Checks that the subject has no StyleSpans on any of the text between start and end.
This fails even if the start and end indexes don't exactly match.
| Parameters | |
|---|---|
int start |
The start index to start searching for spans. |
int end |
The end index to stop searching for spans. |
hasNoTextEmphasisSpanBetween
public void hasNoTextEmphasisSpanBetween(int start, int end)
Checks that the subject has no TextEmphasisSpans on any of the text between
start and end.
This fails even if the start and end indexes don't exactly match.
| Parameters | |
|---|---|
int start |
The start index to start searching for spans. |
int end |
The end index to stop searching for spans. |
hasNoTypefaceSpanBetween
public void hasNoTypefaceSpanBetween(int start, int end)
Checks that the subject has no TypefaceSpans on any of the text between start and end.
This fails even if the start and end indexes don't exactly match.
| Parameters | |
|---|---|
int start |
The start index to start searching for spans. |
int end |
The end index to stop searching for spans. |
hasNoUnderlineSpanBetween
public void hasNoUnderlineSpanBetween(int start, int end)
Checks that the subject has no UnderlineSpans on any of the text between start and end.
This fails even if the start and end indexes don't exactly match.
| Parameters | |
|---|---|
int start |
The start index to start searching for spans. |
int end |
The end index to stop searching for spans. |
hasNoVoiceSpanBetween
public void hasNoVoiceSpanBetween(int start, int end)
Checks that the subject has no VoiceSpans on any of the text between start and end.
This fails even if the start and end indexes don't exactly match.
| Parameters | |
|---|---|
int start |
The start index to start searching for spans. |
int end |
The end index to stop searching for spans. |
hasRelativeSizeSpanBetween
public SpannedSubject.RelativeSized hasRelativeSizeSpanBetween(int start, int end)
Checks that the subject has a RelativeSizeSpan from start to end.
The size is asserted in a follow-up method call on the return RelativeSized object.
| Parameters | |
|---|---|
int start |
The start of the expected span. |
int end |
The end of the expected span. |
| Returns | |
|---|---|
SpannedSubject.RelativeSized |
A |
hasRubySpanBetween
public SpannedSubject.RubyText hasRubySpanBetween(int start, int end)
Checks that the subject has a RubySpan from start to end.
The ruby-text is asserted in a follow-up method call on the return RubyText object.
| Parameters | |
|---|---|
int start |
The start of the expected span. |
int end |
The end of the expected span. |
| Returns | |
|---|---|
SpannedSubject.RubyText |
A |
hasStrikethroughSpanBetween
public SpannedSubject.WithSpanFlags hasStrikethroughSpanBetween(int start, int end)
Checks that the subject has an StrikethroughSpan from start to end.
| Parameters | |
|---|---|
int start |
The start of the expected span. |
int end |
The end of the expected span. |
| Returns | |
|---|---|
SpannedSubject.WithSpanFlags |
A |
hasTextEmphasisSpanBetween
public SpannedSubject.EmphasizedText hasTextEmphasisSpanBetween(int start, int end)
Checks that the subject has an TextEmphasisSpan from start to end.
| Parameters | |
|---|---|
int start |
The start of the expected span. |
int end |
The end of the expected span. |
| Returns | |
|---|---|
SpannedSubject.EmphasizedText |
A |
hasTypefaceSpanBetween
public SpannedSubject.Typefaced hasTypefaceSpanBetween(int start, int end)
Checks that the subject has a TypefaceSpan from start to end.
The font is asserted in a follow-up method call on the return Typefaced object.
| Parameters | |
|---|---|
int start |
The start of the expected span. |
int end |
The end of the expected span. |
| Returns | |
|---|---|
SpannedSubject.Typefaced |
A |
hasUnderlineSpanBetween
public SpannedSubject.WithSpanFlags hasUnderlineSpanBetween(int start, int end)
Checks that the subject has an UnderlineSpan from start to end.
| Parameters | |
|---|---|
int start |
The start of the expected span. |
int end |
The end of the expected span. |
| Returns | |
|---|---|
SpannedSubject.WithSpanFlags |
A |
hasVoiceSpanBetween
public SpannedSubject.VoiceText hasVoiceSpanBetween(int start, int end)
Checks that the subject has an VoiceSpan from start to end.
| Parameters | |
|---|---|
int start |
The start of the expected span. |
int end |
The end of the expected span. |
| Returns | |
|---|---|
SpannedSubject.VoiceText |
A |