Bug 978173 - Part 4: Add test for VTTCue::Region. r=rillian
☠☠ backed out by db2eef61b22a ☠ ☠
authorRick Eyre <rick.eyre@hotmail.com>
Tue, 11 Mar 2014 14:06:44 -0400
changeset 191641 2b3efd1687ecf27e7c583615b6ed381d39e9e65c
parent 191640 a35718f7ef732b8cb5a2bb74a5a384f1b47c3d31
child 191642 db2eef61b22adeeec6a786e20452a89bd4ee8b03
push id474
push userasasaki@mozilla.com
push dateMon, 02 Jun 2014 21:01:02 +0000
treeherdermozilla-release@967f4cf1b31c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrillian
bugs978173, 24380
milestone30.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
content/media/test/basic.vtt
content/media/test/test_texttrackcue.html
content/media/test/test_texttrackregion.html
--- a/content/media/test/basic.vtt
+++ b/content/media/test/basic.vtt
@@ -1,20 +1,22 @@
 WEBVTT
+Region: id=testOne lines=2 width=30%
+Region: id=testTwo lines=4 width=20%
 
 1
-00:00.500 --> 00:00.700
+00:00.500 --> 00:00.700 region:testOne
 This
 
 2
-00:01.200 --> 00:02.400
+00:01.200 --> 00:02.400 region:testTwo
 Is
 
 2.5
-00:02.000 --> 00:03.500
+00:02.000 --> 00:03.500 region:testOne
 (Over here?!)
 
 3
 00:02.710 --> 00:02.910
 A
 
 4
 00:03.217 --> 00:03.989
--- a/content/media/test/test_texttrackcue.html
+++ b/content/media/test/test_texttrackcue.html
@@ -177,16 +177,31 @@ SpecialPowers.pushPrefEnv({"set": [["med
       isnot(trackElement.track.activeCues, null);
 
       trackElement.track.mode = "disabled";
       is(trackElement.track.activeCues, null);
 
       trackElement.track.mode = "showing";
       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.
       var cueInfo = [
         { startTime: 0.51, endTime: 0.71, ids: ["Cue 01"] },
         { startTime: 0.72, endTime: 1.19, ids: [] },
         { startTime: 1.2, endTime: 1.9, ids: [2] },
         { startTime: 2, endTime: 2.4, ids: [2, 2.5] },
         { startTime: 2.41, endTime: 2.70, ids: [2.5] },
         { startTime: 2.71, endTime: 2.91, ids: [2.5, 3] },
--- a/content/media/test/test_texttrackregion.html
+++ b/content/media/test/test_texttrackregion.html
@@ -31,35 +31,28 @@ SpecialPowers.pushPrefEnv({"set": [["med
       // Re-que run_tests() at the end of the event loop until the track
       // element has loaded its data.
       if (trackElement.readyState == 1) {
         setTimeout(run_tests, 0);
         return;
       }
       is(trackElement.readyState, 2, "Track::ReadyState should be set to LOADED.");
 
-      var cues = trackElement.track.cues,
-          regions = trackElement.track.regions;
-
-      is(regions.length, 1, "Region list length should be 1.");
+      var cues = trackElement.track.cues;
       is(cues.length, 1, "Cue list length should be 1.");
 
-      is(cues[0].regionId, "fred", "Cue regionId should be 'fred'.");
-
-      var region = regions[0];
-
-      is(region.id, "fred", "Region ID should be 'fred'.");
+      var region = cues[0].region;
+      isnot(region, null, "Region should not be null.");
       is(region.width, 62, "Region width should be 50.");
       is(region.lines, 5, "Region lines should be 5.");
       is(region.regionAnchorX, 4, "Region regionAnchorX should be 4.");
       is(region.regionAnchorY, 78, "Region regionAnchorY should be 78.");
       is(region.viewportAnchorX, 10, "Region viewportAnchorX should be 10.");
       is(region.viewportAnchorY, 90, "Region viewportAnchorY should be 90.");
       is(region.scroll, "up", "Region scroll should be 'up'");
-      is(region.track, trackElement.track, "Tracks should be equal.");
 
       SimpleTest.finish();
     });
   }
 );
 
 </script>
 </pre>