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
f56c1a12
authored
Apr 28, 2021
by
ibaker
Committed by
bachinger
Apr 28, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
SSA: Add a test with a present but empty "Style" line
PiperOrigin-RevId: 370897451
parent
2b120f47
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
1 deletions
library/core/src/test/java/com/google/android/exoplayer2/text/ssa/SsaDecoderTest.java
testdata/src/test/assets/media/ssa/empty_style_line
library/core/src/test/java/com/google/android/exoplayer2/text/ssa/SsaDecoderTest.java
View file @
f56c1a12
...
@@ -38,6 +38,7 @@ import org.junit.runner.RunWith;
...
@@ -38,6 +38,7 @@ import org.junit.runner.RunWith;
public
final
class
SsaDecoderTest
{
public
final
class
SsaDecoderTest
{
private
static
final
String
EMPTY
=
"media/ssa/empty"
;
private
static
final
String
EMPTY
=
"media/ssa/empty"
;
private
static
final
String
EMPTY_STYLE_LINE
=
"media/ssa/empty_style_line"
;
private
static
final
String
TYPICAL
=
"media/ssa/typical"
;
private
static
final
String
TYPICAL
=
"media/ssa/typical"
;
private
static
final
String
TYPICAL_HEADER_ONLY
=
"media/ssa/typical_header"
;
private
static
final
String
TYPICAL_HEADER_ONLY
=
"media/ssa/typical_header"
;
private
static
final
String
TYPICAL_DIALOGUE_ONLY
=
"media/ssa/typical_dialogue"
;
private
static
final
String
TYPICAL_DIALOGUE_ONLY
=
"media/ssa/typical_dialogue"
;
...
@@ -60,7 +61,27 @@ public final class SsaDecoderTest {
...
@@ -60,7 +61,27 @@ public final class SsaDecoderTest {
Subtitle
subtitle
=
decoder
.
decode
(
bytes
,
bytes
.
length
,
false
);
Subtitle
subtitle
=
decoder
.
decode
(
bytes
,
bytes
.
length
,
false
);
assertThat
(
subtitle
.
getEventTimeCount
()).
isEqualTo
(
0
);
assertThat
(
subtitle
.
getEventTimeCount
()).
isEqualTo
(
0
);
assertThat
(
subtitle
.
getCues
(
0
).
isEmpty
()).
isTrue
();
}
@Test
public
void
decodeEmptyStyleLine
()
throws
IOException
{
SsaDecoder
decoder
=
new
SsaDecoder
();
byte
[]
bytes
=
TestUtil
.
getByteArray
(
ApplicationProvider
.
getApplicationContext
(),
EMPTY_STYLE_LINE
);
Subtitle
subtitle
=
decoder
.
decode
(
bytes
,
bytes
.
length
,
/* reset= */
false
);
assertThat
(
subtitle
.
getEventTimeCount
()).
isEqualTo
(
2
);
Cue
cue
=
Iterables
.
getOnlyElement
(
subtitle
.
getCues
(
subtitle
.
getEventTime
(
0
)));
SpannedSubject
.
assertThat
((
Spanned
)
cue
.
text
).
hasNoSpans
();
assertThat
(
cue
.
textSize
).
isEqualTo
(
Cue
.
DIMEN_UNSET
);
assertThat
(
cue
.
textSizeType
).
isEqualTo
(
Cue
.
TYPE_UNSET
);
assertThat
(
cue
.
textAlignment
).
isNull
();
assertThat
(
cue
.
positionAnchor
).
isEqualTo
(
Cue
.
TYPE_UNSET
);
assertThat
(
cue
.
position
).
isEqualTo
(
Cue
.
DIMEN_UNSET
);
assertThat
(
cue
.
size
).
isEqualTo
(
Cue
.
DIMEN_UNSET
);
assertThat
(
cue
.
lineAnchor
).
isEqualTo
(
Cue
.
TYPE_UNSET
);
assertThat
(
cue
.
line
).
isEqualTo
(
Cue
.
DIMEN_UNSET
);
assertThat
(
cue
.
lineType
).
isEqualTo
(
Cue
.
LINE_TYPE_FRACTION
);
}
}
@Test
@Test
...
...
testdata/src/test/assets/media/ssa/empty_style_line
0 → 100644
View file @
f56c1a12
[Script Info]
Title: SSA/ASS Test
Script Type: V4.00+
PlayResX: 1280
PlayResY: 720
[V4+ Styles]
Format: Name
Style: Empty
[Events]
Format: Start ,End ,Style,Text
Dialogue: 0:00:01.00,0:00:03.00,Empty,First line.
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