SpannedSubject
@UnstableApi
class SpannedSubject : Subject
A Truth Subject for assertions on Spanned instances containing text styling.
Summary
Nested types |
|---|
interface SpannedSubject.AbsoluteSizedAllows assertions about the absolute size of a span. |
interface SpannedSubject.AlignedAllows assertions about the alignment of a span. |
interface SpannedSubject.AndSpanFlagsAllows additional assertions to be made on the flags of matching spans. |
interface SpannedSubject.ColoredAllows assertions about the color of a span. |
interface SpannedSubject.EmphasizedTextAllows assertions about a span's text emphasis mark and its position. |
interface SpannedSubject.RelativeSizedAllows assertions about the relative size of a span. |
interface SpannedSubject.RubyTextAllows assertions about a span's ruby text and its position. |
interface SpannedSubject.TypefacedAllows assertions about the typeface of a span. |
interface SpannedSubject.VoiceTextAllows assertions about a span's voice its position. |
interface SpannedSubject.WithSpanFlagsAllows additional assertions to be made on the flags of matching spans. |
Public functions |
|
|---|---|
java-static SpannedSubject! |
assertThat(spanned: Spanned?)Convenience method to create a SpannedSubject. |
SpannedSubject.AbsoluteSized! |
hasAbsoluteSizeSpanBetween(start: Int, end: Int)Checks that the subject has a |
SpannedSubject.Aligned! |
hasAlignmentSpanBetween(start: Int, end: Int)Checks that the subject has a |
SpannedSubject.Colored! |
hasBackgroundColorSpanBetween(start: Int, end: Int)Checks that the subject has a |
SpannedSubject.WithSpanFlags! |
hasBoldItalicSpanBetween(start: Int, end: Int)Checks that the subject has bold and italic styling from |
SpannedSubject.WithSpanFlags! |
hasBoldSpanBetween(start: Int, end: Int)Checks that the subject has a bold span from |
SpannedSubject.Colored! |
hasForegroundColorSpanBetween(start: Int, end: Int)Checks that the subject has a |
SpannedSubject.WithSpanFlags! |
hasHorizontalTextInVerticalContextSpanBetween(start: Int, end: Int)Checks that the subject has an |
SpannedSubject.WithSpanFlags! |
hasItalicSpanBetween(start: Int, end: Int)Checks that the subject has an italic span from |
Unit |
hasNoAbsoluteSizeSpanBetween(start: Int, end: Int)Checks that the subject has no |
Unit |
hasNoAlignmentSpanBetween(start: Int, end: Int)Checks that the subject has no |
Unit |
hasNoBackgroundColorSpanBetween(start: Int, end: Int)Checks that the subject has no |
Unit |
hasNoForegroundColorSpanBetween(start: Int, end: Int)Checks that the subject has no |
Unit |
hasNoHorizontalTextInVerticalContextSpanBetween(start: Int, end: Int)Checks that the subject has no |
Unit |
hasNoRelativeSizeSpanBetween(start: Int, end: Int)Checks that the subject has no |
Unit |
hasNoRubySpanBetween(start: Int, end: Int)Checks that the subject has no |
Unit |
|
Unit |
hasNoStrikethroughSpanBetween(start: Int, end: Int)Checks that the subject has no |
Unit |
hasNoStyleSpanBetween(start: Int, end: Int)Checks that the subject has no |
Unit |
hasNoTextEmphasisSpanBetween(start: Int, end: Int)Checks that the subject has no |
Unit |
hasNoTypefaceSpanBetween(start: Int, end: Int)Checks that the subject has no |
Unit |
hasNoUnderlineSpanBetween(start: Int, end: Int)Checks that the subject has no |
Unit |
hasNoVoiceSpanBetween(start: Int, end: Int)Checks that the subject has no |
SpannedSubject.RelativeSized! |
hasRelativeSizeSpanBetween(start: Int, end: Int)Checks that the subject has a |
SpannedSubject.RubyText! |
hasRubySpanBetween(start: Int, end: Int)Checks that the subject has a |
SpannedSubject.WithSpanFlags! |
hasStrikethroughSpanBetween(start: Int, end: Int)Checks that the subject has an |
SpannedSubject.EmphasizedText! |
hasTextEmphasisSpanBetween(start: Int, end: Int)Checks that the subject has an |
SpannedSubject.Typefaced! |
hasTypefaceSpanBetween(start: Int, end: Int)Checks that the subject has a |
SpannedSubject.WithSpanFlags! |
hasUnderlineSpanBetween(start: Int, end: Int)Checks that the subject has an |
SpannedSubject.VoiceText! |
hasVoiceSpanBetween(start: Int, end: Int)Checks that the subject has an |
java-static Subject.Factory<SpannedSubject!, Spanned!>! |
spanned() |
Inherited functions |
||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Public functions
assertThat
java-static fun assertThat(spanned: Spanned?): SpannedSubject!
Convenience method to create a SpannedSubject.
Can be statically imported alongside other Truth assertThat methods.
| Parameters | |
|---|---|
spanned: Spanned? |
The subject under test. |
| Returns | |
|---|---|
SpannedSubject! |
An object for conducting assertions on the subject. |
hasAbsoluteSizeSpanBetween
fun hasAbsoluteSizeSpanBetween(start: Int, end: Int): SpannedSubject.AbsoluteSized!
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.
| Returns | |
|---|---|
SpannedSubject.AbsoluteSized! |
A |
hasAlignmentSpanBetween
fun hasAlignmentSpanBetween(start: Int, end: Int): SpannedSubject.Aligned!
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.
| Returns | |
|---|---|
SpannedSubject.Aligned! |
A |
hasBackgroundColorSpanBetween
fun hasBackgroundColorSpanBetween(start: Int, end: Int): SpannedSubject.Colored!
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.
| Returns | |
|---|---|
SpannedSubject.Colored! |
A |
hasBoldItalicSpanBetween
fun hasBoldItalicSpanBetween(start: Int, end: Int): SpannedSubject.WithSpanFlags!
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.
| Returns | |
|---|---|
SpannedSubject.WithSpanFlags! |
A |
hasBoldSpanBetween
fun hasBoldSpanBetween(start: Int, end: Int): SpannedSubject.WithSpanFlags!
Checks that the subject has a bold span from start to end.
| Returns | |
|---|---|
SpannedSubject.WithSpanFlags! |
A |
hasForegroundColorSpanBetween
fun hasForegroundColorSpanBetween(start: Int, end: Int): SpannedSubject.Colored!
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.
| Returns | |
|---|---|
SpannedSubject.Colored! |
A |
hasHorizontalTextInVerticalContextSpanBetween
fun hasHorizontalTextInVerticalContextSpanBetween(start: Int, end: Int): SpannedSubject.WithSpanFlags!
Checks that the subject has an HorizontalTextInVerticalContextSpan from start to end.
| Returns | |
|---|---|
SpannedSubject.WithSpanFlags! |
A |
hasItalicSpanBetween
fun hasItalicSpanBetween(start: Int, end: Int): SpannedSubject.WithSpanFlags!
Checks that the subject has an italic span from start to end.
| Returns | |
|---|---|
SpannedSubject.WithSpanFlags! |
A |
hasNoAbsoluteSizeSpanBetween
fun hasNoAbsoluteSizeSpanBetween(start: Int, end: Int): Unit
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.
hasNoAlignmentSpanBetween
fun hasNoAlignmentSpanBetween(start: Int, end: Int): Unit
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.
hasNoBackgroundColorSpanBetween
fun hasNoBackgroundColorSpanBetween(start: Int, end: Int): Unit
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.
hasNoForegroundColorSpanBetween
fun hasNoForegroundColorSpanBetween(start: Int, end: Int): Unit
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.
hasNoHorizontalTextInVerticalContextSpanBetween
fun hasNoHorizontalTextInVerticalContextSpanBetween(start: Int, end: Int): Unit
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.
hasNoRelativeSizeSpanBetween
fun hasNoRelativeSizeSpanBetween(start: Int, end: Int): Unit
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.
hasNoRubySpanBetween
fun hasNoRubySpanBetween(start: Int, end: Int): Unit
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.
hasNoStrikethroughSpanBetween
fun hasNoStrikethroughSpanBetween(start: Int, end: Int): Unit
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.
hasNoStyleSpanBetween
fun hasNoStyleSpanBetween(start: Int, end: Int): Unit
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.
hasNoTextEmphasisSpanBetween
fun hasNoTextEmphasisSpanBetween(start: Int, end: Int): Unit
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.
hasNoTypefaceSpanBetween
fun hasNoTypefaceSpanBetween(start: Int, end: Int): Unit
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.
hasNoUnderlineSpanBetween
fun hasNoUnderlineSpanBetween(start: Int, end: Int): Unit
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.
hasNoVoiceSpanBetween
fun hasNoVoiceSpanBetween(start: Int, end: Int): Unit
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.
hasRelativeSizeSpanBetween
fun hasRelativeSizeSpanBetween(start: Int, end: Int): SpannedSubject.RelativeSized!
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.
| Returns | |
|---|---|
SpannedSubject.RelativeSized! |
A |
hasRubySpanBetween
fun hasRubySpanBetween(start: Int, end: Int): SpannedSubject.RubyText!
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.
| Returns | |
|---|---|
SpannedSubject.RubyText! |
A |
hasStrikethroughSpanBetween
fun hasStrikethroughSpanBetween(start: Int, end: Int): SpannedSubject.WithSpanFlags!
Checks that the subject has an StrikethroughSpan from start to end.
| Returns | |
|---|---|
SpannedSubject.WithSpanFlags! |
A |
hasTextEmphasisSpanBetween
fun hasTextEmphasisSpanBetween(start: Int, end: Int): SpannedSubject.EmphasizedText!
Checks that the subject has an TextEmphasisSpan from start to end.
| Returns | |
|---|---|
SpannedSubject.EmphasizedText! |
A |
hasTypefaceSpanBetween
fun hasTypefaceSpanBetween(start: Int, end: Int): SpannedSubject.Typefaced!
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.
| Returns | |
|---|---|
SpannedSubject.Typefaced! |
A |
hasUnderlineSpanBetween
fun hasUnderlineSpanBetween(start: Int, end: Int): SpannedSubject.WithSpanFlags!
Checks that the subject has an UnderlineSpan from start to end.
| Returns | |
|---|---|
SpannedSubject.WithSpanFlags! |
A |
hasVoiceSpanBetween
fun hasVoiceSpanBetween(start: Int, end: Int): SpannedSubject.VoiceText!
Checks that the subject has an VoiceSpan from start to end.
| Returns | |
|---|---|
SpannedSubject.VoiceText! |
A |