Class SpannedSubject
- java.lang.Object
-
- com.google.common.truth.Subject
-
- com.google.android.exoplayer2.testutil.truth.SpannedSubject
-
public final class SpannedSubject extends com.google.common.truth.Subject
A TruthSubject
for assertions onSpanned
instances containing text styling.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
SpannedSubject.AbsoluteSized
Allows assertions about the absolute size of a span.static interface
SpannedSubject.Aligned
Allows assertions about the alignment of a span.static interface
SpannedSubject.AndSpanFlags
Allows additional assertions to be made on the flags of matching spans.static interface
SpannedSubject.Colored
Allows assertions about the color of a span.static interface
SpannedSubject.EmphasizedText
Allows assertions about a span's text emphasis mark and its position.static interface
SpannedSubject.RelativeSized
Allows assertions about the relative size of a span.static interface
SpannedSubject.RubyText
Allows assertions about a span's ruby text and its position.static interface
SpannedSubject.Typefaced
Allows assertions about the typeface of a span.static interface
SpannedSubject.WithSpanFlags
Allows additional assertions to be made on the flags of matching spans.-
Nested classes/interfaces inherited from class com.google.common.truth.Subject
com.google.common.truth.Subject.Factory<SubjectT extends com.google.common.truth.Subject,ActualT extends Object>
-
-
Method Summary
-
Methods inherited from class com.google.common.truth.Subject
actualCustomStringRepresentation, check, equals, failWithActual, failWithActual, failWithoutActual, hashCode, ignoreCheck, isAnyOf, isEqualTo, isIn, isInstanceOf, isNoneOf, isNotEqualTo, isNotIn, isNotInstanceOf, isNotNull, isNotSameInstanceAs, isNull, isSameInstanceAs, toString
-
-
-
-
Method Detail
-
spanned
public static com.google.common.truth.Subject.Factory<SpannedSubject,Spanned> spanned()
-
assertThat
public static SpannedSubject assertThat(@Nullable Spanned spanned)
Convenience method to create a SpannedSubject.Can be statically imported alongside other Truth
assertThat
methods.- Parameters:
spanned
- The subject under test.- Returns:
- An object for conducting assertions on the subject.
-
hasNoSpans
public void hasNoSpans()
-
hasItalicSpanBetween
public SpannedSubject.WithSpanFlags hasItalicSpanBetween(int start, int end)
Checks that the subject has an italic span fromstart
toend
.- Parameters:
start
- The start of the expected span.end
- The end of the expected span.- Returns:
- A
SpannedSubject.WithSpanFlags
object for optional additional assertions on the flags.
-
hasBoldSpanBetween
public SpannedSubject.WithSpanFlags hasBoldSpanBetween(int start, int end)
Checks that the subject has a bold span fromstart
toend
.- Parameters:
start
- The start of the expected span.end
- The end of the expected span.- Returns:
- A
SpannedSubject.WithSpanFlags
object for optional additional assertions on the flags.
-
hasBoldItalicSpanBetween
public SpannedSubject.WithSpanFlags hasBoldItalicSpanBetween(int start, int end)
Checks that the subject has bold and italic styling fromstart
toend
.This can either be:
- Parameters:
start
- The start of the expected span.end
- The end of the expected span.- Returns:
- A
SpannedSubject.WithSpanFlags
object for optional additional assertions on the flags.
-
hasNoStyleSpanBetween
public void hasNoStyleSpanBetween(int start, int end)
Checks that the subject has noStyleSpan
s on any of the text betweenstart
andend
.This fails even if the start and end indexes don't exactly match.
- Parameters:
start
- The start index to start searching for spans.end
- The end index to stop searching for spans.
-
hasUnderlineSpanBetween
public SpannedSubject.WithSpanFlags hasUnderlineSpanBetween(int start, int end)
- Parameters:
start
- The start of the expected span.end
- The end of the expected span.- Returns:
- A
SpannedSubject.WithSpanFlags
object for optional additional assertions on the flags.
-
hasNoUnderlineSpanBetween
public void hasNoUnderlineSpanBetween(int start, int end)
Checks that the subject has noUnderlineSpan
s on any of the text betweenstart
andend
.This fails even if the start and end indexes don't exactly match.
- Parameters:
start
- The start index to start searching for spans.end
- The end index to stop searching for spans.
-
hasStrikethroughSpanBetween
public SpannedSubject.WithSpanFlags hasStrikethroughSpanBetween(int start, int end)
- Parameters:
start
- The start of the expected span.end
- The end of the expected span.- Returns:
- A
SpannedSubject.WithSpanFlags
object for optional additional assertions on the flags.
-
hasNoStrikethroughSpanBetween
public void hasNoStrikethroughSpanBetween(int start, int end)
Checks that the subject has noStrikethroughSpan
s on any of the text betweenstart
andend
.This fails even if the start and end indexes don't exactly match.
- Parameters:
start
- The start index to start searching for spans.end
- The end index to stop searching for spans.
-
hasAlignmentSpanBetween
@CheckResult public SpannedSubject.Aligned hasAlignmentSpanBetween(int start, int end)
Checks that the subject has aAlignmentSpan
fromstart
toend
.The alignment is asserted in a follow-up method call on the return
SpannedSubject.Aligned
object.- Parameters:
start
- The start of the expected span.end
- The end of the expected span.- Returns:
- A
SpannedSubject.Aligned
object to assert on the alignment of the matching spans.
-
hasNoAlignmentSpanBetween
public void hasNoAlignmentSpanBetween(int start, int end)
Checks that the subject has noAlignmentSpan
s on any of the text betweenstart
andend
.This fails even if the start and end indexes don't exactly match.
- Parameters:
start
- The start index to start searching for spans.end
- The end index to stop searching for spans.
-
hasForegroundColorSpanBetween
@CheckResult public SpannedSubject.Colored hasForegroundColorSpanBetween(int start, int end)
Checks that the subject has aForegroundColorSpan
fromstart
toend
.The color is asserted in a follow-up method call on the return
SpannedSubject.Colored
object.- Parameters:
start
- The start of the expected span.end
- The end of the expected span.- Returns:
- A
SpannedSubject.Colored
object to assert on the color of the matching spans.
-
hasNoForegroundColorSpanBetween
public void hasNoForegroundColorSpanBetween(int start, int end)
Checks that the subject has noForegroundColorSpan
s on any of the text betweenstart
andend
.This fails even if the start and end indexes don't exactly match.
- Parameters:
start
- The start index to start searching for spans.end
- The end index to stop searching for spans.
-
hasBackgroundColorSpanBetween
@CheckResult public SpannedSubject.Colored hasBackgroundColorSpanBetween(int start, int end)
Checks that the subject has aBackgroundColorSpan
fromstart
toend
.The color is asserted in a follow-up method call on the return
SpannedSubject.Colored
object.- Parameters:
start
- The start of the expected span.end
- The end of the expected span.- Returns:
- A
SpannedSubject.Colored
object to assert on the color of the matching spans.
-
hasNoBackgroundColorSpanBetween
public void hasNoBackgroundColorSpanBetween(int start, int end)
Checks that the subject has noBackgroundColorSpan
s on any of the text betweenstart
andend
.This fails even if the start and end indexes don't exactly match.
- Parameters:
start
- The start index to start searching for spans.end
- The end index to stop searching for spans.
-
hasTypefaceSpanBetween
@CheckResult public SpannedSubject.Typefaced hasTypefaceSpanBetween(int start, int end)
Checks that the subject has aTypefaceSpan
fromstart
toend
.The font is asserted in a follow-up method call on the return
SpannedSubject.Typefaced
object.- Parameters:
start
- The start of the expected span.end
- The end of the expected span.- Returns:
- A
SpannedSubject.Typefaced
object to assert on the font of the matching spans.
-
hasNoTypefaceSpanBetween
public void hasNoTypefaceSpanBetween(int start, int end)
Checks that the subject has noTypefaceSpan
s on any of the text betweenstart
andend
.This fails even if the start and end indexes don't exactly match.
- Parameters:
start
- The start index to start searching for spans.end
- The end index to stop searching for spans.
-
hasAbsoluteSizeSpanBetween
@CheckResult public SpannedSubject.AbsoluteSized hasAbsoluteSizeSpanBetween(int start, int end)
Checks that the subject has aAbsoluteSizeSpan
fromstart
toend
.The size is asserted in a follow-up method call on the return
SpannedSubject.AbsoluteSized
object.- Parameters:
start
- The start of the expected span.end
- The end of the expected span.- Returns:
- A
SpannedSubject.AbsoluteSized
object to assert on the size of the matching spans.
-
hasNoAbsoluteSizeSpanBetween
public void hasNoAbsoluteSizeSpanBetween(int start, int end)
Checks that the subject has noAbsoluteSizeSpan
s on any of the text betweenstart
andend
.This fails even if the start and end indexes don't exactly match.
- Parameters:
start
- The start index to start searching for spans.end
- The end index to stop searching for spans.
-
hasRelativeSizeSpanBetween
@CheckResult public SpannedSubject.RelativeSized hasRelativeSizeSpanBetween(int start, int end)
Checks that the subject has aRelativeSizeSpan
fromstart
toend
.The size is asserted in a follow-up method call on the return
SpannedSubject.RelativeSized
object.- Parameters:
start
- The start of the expected span.end
- The end of the expected span.- Returns:
- A
SpannedSubject.RelativeSized
object to assert on the size of the matching spans.
-
hasNoRelativeSizeSpanBetween
public void hasNoRelativeSizeSpanBetween(int start, int end)
Checks that the subject has noRelativeSizeSpan
s on any of the text betweenstart
andend
.This fails even if the start and end indexes don't exactly match.
- Parameters:
start
- The start index to start searching for spans.end
- The end index to stop searching for spans.
-
hasRubySpanBetween
@CheckResult public SpannedSubject.RubyText hasRubySpanBetween(int start, int end)
Checks that the subject has aRubySpan
fromstart
toend
.The ruby-text is asserted in a follow-up method call on the return
SpannedSubject.RubyText
object.- Parameters:
start
- The start of the expected span.end
- The end of the expected span.- Returns:
- A
SpannedSubject.Colored
object to assert on the color of the matching spans.
-
hasNoRubySpanBetween
public void hasNoRubySpanBetween(int start, int end)
Checks that the subject has noRubySpan
s on any of the text betweenstart
andend
.This fails even if the start and end indexes don't exactly match.
- Parameters:
start
- The start index to start searching for spans.end
- The end index to stop searching for spans.
-
hasHorizontalTextInVerticalContextSpanBetween
public SpannedSubject.WithSpanFlags hasHorizontalTextInVerticalContextSpanBetween(int start, int end)
- Parameters:
start
- The start of the expected span.end
- The end of the expected span.- Returns:
- A
SpannedSubject.WithSpanFlags
object for optional additional assertions on the flags.
-
hasTextEmphasisSpanBetween
public SpannedSubject.EmphasizedText hasTextEmphasisSpanBetween(int start, int end)
- Parameters:
start
- The start of the expected span.end
- The end of the expected span.- Returns:
- A
SpannedSubject.EmphasizedText
object for optional additional assertions on the flags.
-
hasNoTextEmphasisSpanBetween
public void hasNoTextEmphasisSpanBetween(int start, int end)
Checks that the subject has noTextEmphasisSpan
s on any of the text betweenstart
andend
.This fails even if the start and end indexes don't exactly match.
- Parameters:
start
- The start index to start searching for spans.end
- The end index to stop searching for spans.
-
hasNoHorizontalTextInVerticalContextSpanBetween
public void hasNoHorizontalTextInVerticalContextSpanBetween(int start, int end)
Checks that the subject has noHorizontalTextInVerticalContextSpan
s on any of the text betweenstart
andend
.This fails even if the start and end indexes don't exactly match.
- Parameters:
start
- The start index to start searching for spans.end
- The end index to stop searching for spans.
-
-