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.SubjectA TruthSubjectfor assertions onSpannedinstances containing text styling.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceSpannedSubject.AbsoluteSizedAllows assertions about the absolute size of a span.static interfaceSpannedSubject.AlignedAllows assertions about the alignment of a span.static interfaceSpannedSubject.AndSpanFlagsAllows additional assertions to be made on the flags of matching spans.static interfaceSpannedSubject.ColoredAllows assertions about the color of a span.static interfaceSpannedSubject.EmphasizedTextAllows assertions about a span's text emphasis mark and its position.static interfaceSpannedSubject.RelativeSizedAllows assertions about the relative size of a span.static interfaceSpannedSubject.RubyTextAllows assertions about a span's ruby text and its position.static interfaceSpannedSubject.TypefacedAllows assertions about the typeface of a span.static interfaceSpannedSubject.WithSpanFlagsAllows 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
assertThatmethods.- 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 fromstarttoend.- Parameters:
start- The start of the expected span.end- The end of the expected span.- Returns:
- A
SpannedSubject.WithSpanFlagsobject for optional additional assertions on the flags.
-
hasBoldSpanBetween
public SpannedSubject.WithSpanFlags hasBoldSpanBetween(int start, int end)
Checks that the subject has a bold span fromstarttoend.- Parameters:
start- The start of the expected span.end- The end of the expected span.- Returns:
- A
SpannedSubject.WithSpanFlagsobject 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 fromstarttoend.This can either be:
- Parameters:
start- The start of the expected span.end- The end of the expected span.- Returns:
- A
SpannedSubject.WithSpanFlagsobject for optional additional assertions on the flags.
-
hasNoStyleSpanBetween
public void hasNoStyleSpanBetween(int start, int end)Checks that the subject has noStyleSpans on any of the text betweenstartandend.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.WithSpanFlagsobject for optional additional assertions on the flags.
-
hasNoUnderlineSpanBetween
public void hasNoUnderlineSpanBetween(int start, int end)Checks that the subject has noUnderlineSpans on any of the text betweenstartandend.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.WithSpanFlagsobject for optional additional assertions on the flags.
-
hasNoStrikethroughSpanBetween
public void hasNoStrikethroughSpanBetween(int start, int end)Checks that the subject has noStrikethroughSpans on any of the text betweenstartandend.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 aAlignmentSpanfromstarttoend.The alignment is asserted in a follow-up method call on the return
SpannedSubject.Alignedobject.- Parameters:
start- The start of the expected span.end- The end of the expected span.- Returns:
- A
SpannedSubject.Alignedobject to assert on the alignment of the matching spans.
-
hasNoAlignmentSpanBetween
public void hasNoAlignmentSpanBetween(int start, int end)Checks that the subject has noAlignmentSpans on any of the text betweenstartandend.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 aForegroundColorSpanfromstarttoend.The color is asserted in a follow-up method call on the return
SpannedSubject.Coloredobject.- Parameters:
start- The start of the expected span.end- The end of the expected span.- Returns:
- A
SpannedSubject.Coloredobject to assert on the color of the matching spans.
-
hasNoForegroundColorSpanBetween
public void hasNoForegroundColorSpanBetween(int start, int end)Checks that the subject has noForegroundColorSpans on any of the text betweenstartandend.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 aBackgroundColorSpanfromstarttoend.The color is asserted in a follow-up method call on the return
SpannedSubject.Coloredobject.- Parameters:
start- The start of the expected span.end- The end of the expected span.- Returns:
- A
SpannedSubject.Coloredobject to assert on the color of the matching spans.
-
hasNoBackgroundColorSpanBetween
public void hasNoBackgroundColorSpanBetween(int start, int end)Checks that the subject has noBackgroundColorSpans on any of the text betweenstartandend.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 aTypefaceSpanfromstarttoend.The font is asserted in a follow-up method call on the return
SpannedSubject.Typefacedobject.- Parameters:
start- The start of the expected span.end- The end of the expected span.- Returns:
- A
SpannedSubject.Typefacedobject to assert on the font of the matching spans.
-
hasNoTypefaceSpanBetween
public void hasNoTypefaceSpanBetween(int start, int end)Checks that the subject has noTypefaceSpans on any of the text betweenstartandend.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 aAbsoluteSizeSpanfromstarttoend.The size is asserted in a follow-up method call on the return
SpannedSubject.AbsoluteSizedobject.- Parameters:
start- The start of the expected span.end- The end of the expected span.- Returns:
- A
SpannedSubject.AbsoluteSizedobject to assert on the size of the matching spans.
-
hasNoAbsoluteSizeSpanBetween
public void hasNoAbsoluteSizeSpanBetween(int start, int end)Checks that the subject has noAbsoluteSizeSpans on any of the text betweenstartandend.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 aRelativeSizeSpanfromstarttoend.The size is asserted in a follow-up method call on the return
SpannedSubject.RelativeSizedobject.- Parameters:
start- The start of the expected span.end- The end of the expected span.- Returns:
- A
SpannedSubject.RelativeSizedobject to assert on the size of the matching spans.
-
hasNoRelativeSizeSpanBetween
public void hasNoRelativeSizeSpanBetween(int start, int end)Checks that the subject has noRelativeSizeSpans on any of the text betweenstartandend.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 aRubySpanfromstarttoend.The ruby-text is asserted in a follow-up method call on the return
SpannedSubject.RubyTextobject.- Parameters:
start- The start of the expected span.end- The end of the expected span.- Returns:
- A
SpannedSubject.Coloredobject to assert on the color of the matching spans.
-
hasNoRubySpanBetween
public void hasNoRubySpanBetween(int start, int end)Checks that the subject has noRubySpans on any of the text betweenstartandend.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.WithSpanFlagsobject 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.EmphasizedTextobject for optional additional assertions on the flags.
-
hasNoTextEmphasisSpanBetween
public void hasNoTextEmphasisSpanBetween(int start, int end)Checks that the subject has noTextEmphasisSpans on any of the text betweenstartandend.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 noHorizontalTextInVerticalContextSpans on any of the text betweenstartandend.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.
-
-