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
87dfaff7
authored
Jun 10, 2015
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Fix SRT test
parent
1b1769bb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
18 deletions
library/src/test/java/com/google/android/exoplayer/text/subrip/SubripParserTest.java
library/src/test/java/com/google/android/exoplayer/text/subrip/SubripParserTest.java
View file @
87dfaff7
...
@@ -15,10 +15,10 @@
...
@@ -15,10 +15,10 @@
*/
*/
package
com
.
google
.
android
.
exoplayer
.
text
.
subrip
;
package
com
.
google
.
android
.
exoplayer
.
text
.
subrip
;
import
android.test.InstrumentationTestCase
;
import
com.google.android.exoplayer.C
;
import
com.google.android.exoplayer.C
;
import
android.test.InstrumentationTestCase
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
...
@@ -34,13 +34,10 @@ public class SubripParserTest extends InstrumentationTestCase {
...
@@ -34,13 +34,10 @@ public class SubripParserTest extends InstrumentationTestCase {
SubripParser
parser
=
new
SubripParser
();
SubripParser
parser
=
new
SubripParser
();
InputStream
inputStream
=
InputStream
inputStream
=
getInstrumentation
().
getContext
().
getResources
().
getAssets
().
open
(
EMPTY_SUBRIP_FILE
);
getInstrumentation
().
getContext
().
getResources
().
getAssets
().
open
(
EMPTY_SUBRIP_FILE
);
SubripSubtitle
subtitle
=
parser
.
parse
(
inputStream
,
C
.
UTF8_NAME
,
0
);
try
{
// Assert that the subtitle is empty.
parser
.
parse
(
inputStream
,
C
.
UTF8_NAME
,
0
);
assertEquals
(
0
,
subtitle
.
getEventTimeCount
());
fail
(
"Expected IOException"
);
assertTrue
(
subtitle
.
getCues
(
0
).
isEmpty
());
}
catch
(
IOException
expected
)
{
// Do nothing.
}
}
}
public
void
testParseTypicalSubripFile
()
throws
IOException
{
public
void
testParseTypicalSubripFile
()
throws
IOException
{
...
@@ -49,22 +46,21 @@ public class SubripParserTest extends InstrumentationTestCase {
...
@@ -49,22 +46,21 @@ public class SubripParserTest extends InstrumentationTestCase {
getInstrumentation
().
getContext
().
getResources
().
getAssets
().
open
(
TYPICAL_SUBRIP_FILE
);
getInstrumentation
().
getContext
().
getResources
().
getAssets
().
open
(
TYPICAL_SUBRIP_FILE
);
SubripSubtitle
subtitle
=
parser
.
parse
(
inputStream
,
C
.
UTF8_NAME
,
0
);
SubripSubtitle
subtitle
=
parser
.
parse
(
inputStream
,
C
.
UTF8_NAME
,
0
);
// test start time and event count
// Test start time and event count.
long
startTimeUs
=
0
;
assertEquals
(
0
,
subtitle
.
getStartTime
());
assertEquals
(
startTimeUs
,
subtitle
.
getStartTime
());
assertEquals
(
4
,
subtitle
.
getEventTimeCount
());
assertEquals
(
4
,
subtitle
.
getEventTimeCount
());
//
test first cue
//
Test first cue.
assertEquals
(
startTimeUs
,
subtitle
.
getEventTime
(
0
));
assertEquals
(
0
,
subtitle
.
getEventTime
(
0
));
assertEquals
(
"This is the first subtitle."
,
assertEquals
(
"This is the first subtitle."
,
subtitle
.
getCues
(
subtitle
.
getEventTime
(
0
)).
get
(
0
).
text
.
toString
());
subtitle
.
getCues
(
subtitle
.
getEventTime
(
0
)).
get
(
0
).
text
.
toString
());
assertEquals
(
startTimeUs
+
1234000
,
subtitle
.
getEventTime
(
1
));
assertEquals
(
1234000
,
subtitle
.
getEventTime
(
1
));
//
test second cue
//
Test second cue.
assertEquals
(
startTimeUs
+
2345000
,
subtitle
.
getEventTime
(
2
));
assertEquals
(
2345000
,
subtitle
.
getEventTime
(
2
));
assertEquals
(
"This is the second subtitle.\nSecond subtitle with second line."
,
assertEquals
(
"This is the second subtitle.\nSecond subtitle with second line."
,
subtitle
.
getCues
(
subtitle
.
getEventTime
(
2
)).
get
(
0
).
text
.
toString
());
subtitle
.
getCues
(
subtitle
.
getEventTime
(
2
)).
get
(
0
).
text
.
toString
());
assertEquals
(
startTimeUs
+
3456000
,
subtitle
.
getEventTime
(
3
));
assertEquals
(
3456000
,
subtitle
.
getEventTime
(
3
));
}
}
}
}
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