Bug 978173 - Part 4: Add test for VTTCue::Region. r=rillian

Updated test_texttrackregion.html to reflect the changes as well.

See spec bug: https://www.w3.org/Bugs/Public/show_bug.cgi?id=24380
This commit is contained in:
Rick Eyre 2014-03-11 14:06:44 -04:00
Родитель 5dae77749b
Коммит 6950fb8914
3 изменённых файлов: 23 добавлений и 13 удалений

Просмотреть файл

@ -1,15 +1,17 @@
WEBVTT WEBVTT
Region: id=testOne lines=2 width=30%
Region: id=testTwo lines=4 width=20%
1 1
00:00.500 --> 00:00.700 00:00.500 --> 00:00.700 region:testOne
This This
2 2
00:01.200 --> 00:02.400 00:01.200 --> 00:02.400 region:testTwo
Is Is
2.5 2.5
00:02.000 --> 00:03.500 00:02.000 --> 00:03.500 region:testOne
(Over here?!) (Over here?!)
3 3

Просмотреть файл

@ -182,6 +182,21 @@ SpecialPowers.pushPrefEnv({"set": [["media.webvtt.enabled", true]]},
trackElement.track.mode = "showing"; trackElement.track.mode = "showing";
video.currentTime = 0; video.currentTime = 0;
var regionInfo = [
{ lines: 2, width: 30 },
{ lines: 4, width: 20 },
{ lines: 2, width: 30 }
];
for (var i = 0; i < regionInfo.length; i++) {
var cue = cueList[i];
isnot(cue.region, null, "Cue at " + i + " should have a region.");
for (var key in regionInfo[i]) {
is(cue.region[key], regionInfo[i][key], "Region should have a " + key +
" property with a value of " + regionInfo[i][key])
}
}
// Test TextTrack::ActiveCues. // Test TextTrack::ActiveCues.
var cueInfo = [ var cueInfo = [
{ startTime: 0.51, endTime: 0.71, ids: ["Cue 01"] }, { startTime: 0.51, endTime: 0.71, ids: ["Cue 01"] },

Просмотреть файл

@ -36,17 +36,11 @@ SpecialPowers.pushPrefEnv({"set": [["media.webvtt.enabled", true]]},
} }
is(trackElement.readyState, 2, "Track::ReadyState should be set to LOADED."); is(trackElement.readyState, 2, "Track::ReadyState should be set to LOADED.");
var cues = trackElement.track.cues, var cues = trackElement.track.cues;
regions = trackElement.track.regions;
is(regions.length, 1, "Region list length should be 1.");
is(cues.length, 1, "Cue list length should be 1."); is(cues.length, 1, "Cue list length should be 1.");
is(cues[0].regionId, "fred", "Cue regionId should be 'fred'."); var region = cues[0].region;
isnot(region, null, "Region should not be null.");
var region = regions[0];
is(region.id, "fred", "Region ID should be 'fred'.");
is(region.width, 62, "Region width should be 50."); is(region.width, 62, "Region width should be 50.");
is(region.lines, 5, "Region lines should be 5."); is(region.lines, 5, "Region lines should be 5.");
is(region.regionAnchorX, 4, "Region regionAnchorX should be 4."); is(region.regionAnchorX, 4, "Region regionAnchorX should be 4.");
@ -54,7 +48,6 @@ SpecialPowers.pushPrefEnv({"set": [["media.webvtt.enabled", true]]},
is(region.viewportAnchorX, 10, "Region viewportAnchorX should be 10."); is(region.viewportAnchorX, 10, "Region viewportAnchorX should be 10.");
is(region.viewportAnchorY, 90, "Region viewportAnchorY should be 90."); is(region.viewportAnchorY, 90, "Region viewportAnchorY should be 90.");
is(region.scroll, "up", "Region scroll should be 'up'"); is(region.scroll, "up", "Region scroll should be 'up'");
is(region.track, trackElement.track, "Tracks should be equal.");
SimpleTest.finish(); SimpleTest.finish();
}); });