From 6f2503d3b2f78b5e0626537b6a9ca273c2808f4b Mon Sep 17 00:00:00 2001 From: "eric.carlson@apple.com" Date: Fri, 30 Dec 2011 21:27:14 +0000 Subject: [PATCH] [chromium] media/track/track-cue-rendering.html fails https://bugs.webkit.org/show_bug.cgi?id=75098 Reviewed by Dan Bernstein. * media/media-controls.js: (textTrackDisplayElement): Don't assume there is only one shadow DOM element used to display captions. * media/track/track-cue-nothing-to-render-expected.txt: Updated. * media/track/track-cue-nothing-to-render.html: Fix the test so it checks the track container and cue text pseudo element properties separately. * media/track/track-cue-rendering-expected.txt: Updated for textTrackDisplayElement change. * media/track/track-cue-rendering.html: Ditto. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@103852 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- LayoutTests/ChangeLog | 16 ++++++++++++++++ LayoutTests/media/media-controls.js | 4 ++-- .../track/track-cue-nothing-to-render-expected.txt | 16 ++++++++-------- .../media/track/track-cue-nothing-to-render.html | 2 +- .../media/track/track-cue-rendering-expected.txt | 22 +++++++++++----------- LayoutTests/media/track/track-cue-rendering.html | 19 +++++++++++++------ 6 files changed, 51 insertions(+), 28 deletions(-) diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index 1636781..ff3a5d4 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,3 +1,19 @@ +2011-12-30 Eric Carlson + + [chromium] media/track/track-cue-rendering.html fails + https://bugs.webkit.org/show_bug.cgi?id=75098 + + Reviewed by Dan Bernstein. + + * media/media-controls.js: + (textTrackDisplayElement): Don't assume there is only one shadow DOM element used to + display captions. + * media/track/track-cue-nothing-to-render-expected.txt: Updated. + * media/track/track-cue-nothing-to-render.html: Fix the test so it checks the track + container and cue text pseudo element properties separately. + * media/track/track-cue-rendering-expected.txt: Updated for textTrackDisplayElement change. + * media/track/track-cue-rendering.html: Ditto. + 2011-12-30 Robert Hogan REGRESSION (r94492): Text is shifted to the right in some buttons in the Mac App Store diff --git a/LayoutTests/media/media-controls.js b/LayoutTests/media/media-controls.js index 691d14a..4487d18 100644 --- a/LayoutTests/media/media-controls.js +++ b/LayoutTests/media/media-controls.js @@ -33,9 +33,9 @@ function mediaControlsButtonCoordinates(element, id) return new Array(x, y); } -function textTrackDisplayElement(parentElement) +function textTrackDisplayElement(parentElement, id) { - var controlID = "-webkit-media-text-track-display"; + var controlID = "-webkit-media-text-track-" + id; var displayElement = mediaControlsElement(internals.shadowRoot(parentElement).firstChild, controlID); if (!displayElement) throw "Failed to find media control element ID '" + controlID + "'"; diff --git a/LayoutTests/media/track/track-cue-nothing-to-render-expected.txt b/LayoutTests/media/track/track-cue-nothing-to-render-expected.txt index c4b20f9..1025252 100644 --- a/LayoutTests/media/track/track-cue-nothing-to-render-expected.txt +++ b/LayoutTests/media/track/track-cue-nothing-to-render-expected.txt @@ -3,46 +3,46 @@ Test that cues are rendered and removed. EVENT(canplaythrough) EVENT(seeked) EXPECTED (video.currentTime.toFixed(1) == '0.5') OK -EXPECTED (textTrackDisplayElement(video).innerText == '') OK +EXPECTED (textTrackDisplayElement(video, 'display').innerText == '') OK RUN(video.currentTime = 1.5) EVENT(seeked) EXPECTED (video.currentTime.toFixed(1) == '1.5') OK EXPECTED (testTrack.track.activeCues[0].getCueAsSource() == 'Lorem ipsum dolor sit amet,') OK -EXPECTED (textTrackDisplayElement(video).innerText == 'Lorem ipsum dolor sit amet,') OK +EXPECTED (textTrackDisplayElement(video, 'display').innerText == 'Lorem ipsum dolor sit amet,') OK RUN(video.currentTime = 2.5) EVENT(seeked) EXPECTED (video.currentTime.toFixed(1) == '2.5') OK -EXPECTED (textTrackDisplayElement(video).innerText == '') OK +EXPECTED (textTrackDisplayElement(video, 'display').innerText == '') OK RUN(video.currentTime = 3.3) EVENT(seeked) EXPECTED (video.currentTime.toFixed(1) == '3.3') OK EXPECTED (testTrack.track.activeCues[0].getCueAsSource() == 'consectetuer adipiscing elit,') OK -EXPECTED (textTrackDisplayElement(video).innerText == 'consectetuer adipiscing elit,') OK +EXPECTED (textTrackDisplayElement(video, 'display').innerText == 'consectetuer adipiscing elit,') OK RUN(video.currentTime = 0.6) EVENT(seeked) EXPECTED (video.currentTime.toFixed(1) == '0.6') OK -EXPECTED (textTrackDisplayElement(video).innerText == '') OK +EXPECTED (textTrackDisplayElement(video, 'display').innerText == '') OK RUN(video.currentTime = 5.9) EVENT(seeked) EXPECTED (video.currentTime.toFixed(1) == '5.9') OK EXPECTED (testTrack.track.activeCues[0].getCueAsSource() == 'sed diam nonummy nibh euismod tincidunt') OK -EXPECTED (textTrackDisplayElement(video).innerText == 'sed diam nonummy nibh euismod tincidunt') OK +EXPECTED (textTrackDisplayElement(video, 'display').innerText == 'sed diam nonummy nibh euismod tincidunt') OK RUN(video.currentTime = 4.4) EVENT(seeked) EXPECTED (video.currentTime.toFixed(1) == '4.4') OK -EXPECTED (textTrackDisplayElement(video).innerText == '') OK +EXPECTED (textTrackDisplayElement(video, 'display').innerText == '') OK RUN(video.currentTime = 7.9) EVENT(seeked) EXPECTED (video.currentTime.toFixed(1) == '7.9') OK EXPECTED (testTrack.track.activeCues[0].getCueAsSource() == 'ut laoreet dolore magna aliquam erat volutpat.') OK -EXPECTED (textTrackDisplayElement(video).innerText == 'ut laoreet dolore magna aliquam erat volutpat.') OK +EXPECTED (textTrackDisplayElement(video, 'display').innerText == 'ut laoreet dolore magna aliquam erat volutpat.') OK END OF TEST diff --git a/LayoutTests/media/track/track-cue-nothing-to-render.html b/LayoutTests/media/track/track-cue-nothing-to-render.html index 56dcf0c..7f473ea 100644 --- a/LayoutTests/media/track/track-cue-nothing-to-render.html +++ b/LayoutTests/media/track/track-cue-nothing-to-render.html @@ -31,7 +31,7 @@ testExpected("video.currentTime.toFixed(1)", time.toFixed(1)); if (cueText.length) testExpected("testTrack.track.activeCues[0].getCueAsSource()", cueText); - testExpected("textTrackDisplayElement(video).innerText", cueText); + testExpected("textTrackDisplayElement(video, 'display').innerText", cueText); if (seekedCount >= info.length) { consoleWrite(""); diff --git a/LayoutTests/media/track/track-cue-rendering-expected.txt b/LayoutTests/media/track/track-cue-rendering-expected.txt index 8ce0e05..06ba839 100644 --- a/LayoutTests/media/track/track-cue-rendering-expected.txt +++ b/LayoutTests/media/track/track-cue-rendering-expected.txt @@ -4,48 +4,48 @@ EVENT(seeked) EXPECTED (video.currentTime == '0.5') OK EXPECTED (testTrack.track.activeCues.length == '1') OK EXPECTED (testTrack.track.activeCues[0].getCueAsSource() == 'Lorem') OK -EXPECTED (textTrackDisplayElement(video).innerText == 'Lorem') OK +EXPECTED (textTrackDisplayElement(video, 'display').innerText == 'Lorem') OK RUN(video.currentTime = 1.5) EVENT(seeked) EXPECTED (video.currentTime == '1.5') OK EXPECTED (testTrack.track.activeCues.length == '1') OK EXPECTED (testTrack.track.activeCues[0].getCueAsSource() == 'ipsum') OK -EXPECTED (textTrackDisplayElement(video).innerText == 'ipsum') OK +EXPECTED (textTrackDisplayElement(video, 'display').innerText == 'ipsum') OK RUN(video.currentTime = 2.5) EVENT(seeked) EXPECTED (video.currentTime == '2.5') OK EXPECTED (testTrack.track.activeCues.length == '1') OK EXPECTED (testTrack.track.activeCues[0].getCueAsSource() == 'dolor') OK -EXPECTED (textTrackDisplayElement(video).innerText == 'dolor') OK +EXPECTED (textTrackDisplayElement(video, 'display').innerText == 'dolor') OK RUN(video.currentTime = 3.5) EVENT(seeked) EXPECTED (video.currentTime == '3.5') OK EXPECTED (testTrack.track.activeCues.length == '1') OK EXPECTED (testTrack.track.activeCues[0].getCueAsSource() == 'sit') OK -EXPECTED (textTrackDisplayElement(video).innerText == 'sit') OK +EXPECTED (textTrackDisplayElement(video, 'display').innerText == 'sit') OK Test the cue display colors and font. RUN(video.width = 320) RUN(video.height = 240) -EXPECTED (getComputedStyle(textTrackDisplayElement(video)).fontSize == '12px') OK +EXPECTED (getComputedStyle(textTrackDisplayElement(video, 'container')).fontSize == '12px') OK RUN(video.width = 640) RUN(video.height = 480) -EXPECTED (getComputedStyle(textTrackDisplayElement(video)).fontSize == '24px') OK +EXPECTED (getComputedStyle(textTrackDisplayElement(video, 'container')).fontSize == '24px') OK RUN(video.width = 1280) RUN(video.height = 960) -EXPECTED (getComputedStyle(textTrackDisplayElement(video)).fontSize == '48px') OK +EXPECTED (getComputedStyle(textTrackDisplayElement(video, 'container')).fontSize == '48px') OK RUN(video.width = 2560) RUN(video.height = 1440) -EXPECTED (getComputedStyle(textTrackDisplayElement(video)).fontSize == '72px') OK +EXPECTED (getComputedStyle(textTrackDisplayElement(video, 'container')).fontSize == '72px') OK -EXPECTED (getComputedStyle(textTrackDisplayElement(video)).fontFamily == 'sans-serif') OK -EXPECTED (getComputedStyle(textTrackDisplayElement(video)).color == 'rgba(255, 255, 255, 0)') OK -EXPECTED (getComputedStyle(textTrackDisplayElement(video)).backgroundColor == 'rgba(0, 0, 0, 0.796875)') OK +EXPECTED (getComputedStyle(textTrackDisplayElement(video, 'container')).fontFamily == 'sans-serif') OK +EXPECTED (getComputedStyle(textTrackDisplayElement(video, 'container')).color == 'rgba(255, 255, 255, 0)') OK +EXPECTED (getComputedStyle(textTrackDisplayElement(video, 'display')).backgroundColor == 'rgba(0, 0, 0, 0.796875)') OK END OF TEST diff --git a/LayoutTests/media/track/track-cue-rendering.html b/LayoutTests/media/track/track-cue-rendering.html index 4e6f97f..c695bca 100644 --- a/LayoutTests/media/track/track-cue-rendering.html +++ b/LayoutTests/media/track/track-cue-rendering.html @@ -18,7 +18,7 @@ run("video.width = " + width); run("video.height = " + height); document.body.offsetTop; - testExpected("getComputedStyle(textTrackDisplayElement(video)).fontSize", parseInt(height * 0.05) + "px"); + testExpected("getComputedStyle(textTrackDisplayElement(video, 'container')).fontSize", parseInt(height * 0.05) + "px"); consoleWrite(""); } @@ -30,19 +30,26 @@ testFontSize(1280, 960); testFontSize(2560, 1440); - testExpected("getComputedStyle(textTrackDisplayElement(video)).fontFamily", "sans-serif"); - testExpected("getComputedStyle(textTrackDisplayElement(video)).color", "rgba(255, 255, 255, 0)"); - testExpected("getComputedStyle(textTrackDisplayElement(video)).backgroundColor", "rgba(0, 0, 0, 0.796875)"); + testExpected("getComputedStyle(textTrackDisplayElement(video, 'container')).fontFamily", "sans-serif"); + testExpected("getComputedStyle(textTrackDisplayElement(video, 'container')).color", "rgba(255, 255, 255, 0)"); + testExpected("getComputedStyle(textTrackDisplayElement(video, 'display')).backgroundColor", "rgba(0, 0, 0, 0.796875)"); endTest(); + + // Resize the video so it is easier to interact with it manually, if necessary. + video.width = 320; + video.height = 240; } function seeked() { + if (testEnded) + return; + testExpected("video.currentTime", seekedCount + .5); testExpected("testTrack.track.activeCues.length", 1); testExpected("testTrack.track.activeCues[0].getCueAsSource()", info[seekedCount]); - testExpected("textTrackDisplayElement(video).innerText", info[seekedCount]); + testExpected("textTrackDisplayElement(video, 'display').innerText", info[seekedCount]); if (++seekedCount == info.length) testCueStyle(); @@ -57,7 +64,7 @@ { consoleWrite("Test that TextTrack's cues are rendered correctly."); findMediaElement(); - testTrack = document.querySelectorAll('track')[0]; + testTrack = document.querySelector('track'); video.src = findMediaFile('video', '../content/test'); waitForEvent('seeked', seeked); waitForEvent('canplaythrough', function() { video.currentTime = .5; }); -- 2.7.4