Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
e5eaacec
authored
Jan 08, 2020
by
ibaker
Committed by
Oliver Woodman
Jan 08, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Fix typo in SpannedSubject.hasBoldItalicSpanBetween
PiperOrigin-RevId: 288710939
parent
fa9bf9c8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
2 deletions
testutils/src/main/java/com/google/android/exoplayer2/testutil/truth/SpannedSubject.java
testutils/src/test/java/com/google/android/exoplayer2/testutil/truth/SpannedSubjectTest.java
testutils/src/main/java/com/google/android/exoplayer2/testutil/truth/SpannedSubject.java
View file @
e5eaacec
...
@@ -167,8 +167,8 @@ public final class SpannedSubject extends Subject {
...
@@ -167,8 +167,8 @@ public final class SpannedSubject extends Subject {
simpleFact
(
simpleFact
(
String
.
format
(
"No matching StyleSpans found between start=%s,end=%s"
,
start
,
end
)),
String
.
format
(
"No matching StyleSpans found between start=%s,end=%s"
,
start
,
end
)),
fact
(
"in text"
,
actual
.
toString
()),
fact
(
"in text"
,
actual
.
toString
()),
fact
(
"expected either styles"
,
Arrays
.
as
List
(
Typeface
.
BOLD_ITALIC
)),
fact
(
"expected either styles"
,
Collections
.
singleton
List
(
Typeface
.
BOLD_ITALIC
)),
fact
(
"or styles"
,
Arrays
.
asList
(
Typeface
.
BOLD
,
Typeface
.
BOLD_
ITALIC
)),
fact
(
"or styles"
,
Arrays
.
asList
(
Typeface
.
BOLD
,
Typeface
.
ITALIC
)),
fact
(
"but found styles"
,
styles
));
fact
(
"but found styles"
,
styles
));
return
ALREADY_FAILED_WITH_FLAGS
;
return
ALREADY_FAILED_WITH_FLAGS
;
}
}
...
...
testutils/src/test/java/com/google/android/exoplayer2/testutil/truth/SpannedSubjectTest.java
View file @
e5eaacec
...
@@ -152,6 +152,23 @@ public class SpannedSubjectTest {
...
@@ -152,6 +152,23 @@ public class SpannedSubjectTest {
}
}
@Test
@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
()
{
public
void
boldItalicSpan_mismatchedStartIndex
()
{
SpannableString
spannable
=
SpannableString
.
valueOf
(
"test with bold & italic section"
);
SpannableString
spannable
=
SpannableString
.
valueOf
(
"test with bold & italic section"
);
int
start
=
"test with "
.
length
();
int
start
=
"test with "
.
length
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment