Commit b37e9f69 by olly Committed by Oliver Woodman

For both alignment cue setting value and position cue setting alignment value,

allow "center".
This value (and not "middle") is listed in
https://w3c.github.io/webvtt/ ( WebVTT: The Web Video Text Tracks Format, Draft
Community Group Report, 21 December 2015).

Leaving the behavior for "middle" unchanged.
It was the value listed in older drafts, e.g.
https://www.w3.org/TR/2014/WD-webvtt1-20141113/ ( W3C First Public Working
Draft 13 November 2014 )
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117220612
parent 16f57e39
......@@ -26,3 +26,8 @@ NOTE The positioning alignment should be inherited from align.
00:07.000 --> 00:08.000 position:10% align:end size:10%
This is the fifth subtitle.
NOTE In newer drafts, align:middle has been replaced by align:center
00:10.000 --> 00:11.000 line:45%,end align:center size:35%
This is the sixth subtitle.
......@@ -109,7 +109,7 @@ public class WebvttParserTest extends InstrumentationTestCase {
WebvttSubtitle subtitle = parser.parse(bytes, 0, bytes.length);
// test event count
assertEquals(10, subtitle.getEventTimeCount());
assertEquals(12, subtitle.getEventTimeCount());
// test cues
assertCue(subtitle, 0, 0, 1234000, "This is the first subtitle.", Alignment.ALIGN_NORMAL,
......@@ -126,6 +126,9 @@ public class WebvttParserTest extends InstrumentationTestCase {
assertCue(subtitle, 8, 7000000, 8000000, "This is the fifth subtitle.",
Alignment.ALIGN_OPPOSITE, Cue.DIMEN_UNSET, Cue.TYPE_UNSET, Cue.TYPE_UNSET, 0.1f,
Cue.ANCHOR_TYPE_END, 0.1f);
assertCue(subtitle, 10, 10000000, 11000000, "This is the sixth subtitle.",
Alignment.ALIGN_CENTER, 0.45f, Cue.LINE_TYPE_FRACTION, Cue.ANCHOR_TYPE_END, Cue.DIMEN_UNSET,
Cue.TYPE_UNSET, 0.35f);
}
public void testParseWithBadCueHeader() throws IOException {
......
......@@ -275,6 +275,7 @@ public final class WebvttCueParser {
switch (s) {
case "start":
return Cue.ANCHOR_TYPE_START;
case "center":
case "middle":
return Cue.ANCHOR_TYPE_MIDDLE;
case "end":
......@@ -290,6 +291,7 @@ public final class WebvttCueParser {
case "start":
case "left":
return Alignment.ALIGN_NORMAL;
case "center":
case "middle":
return Alignment.ALIGN_CENTER;
case "end":
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment