blob: b1a606cbd44c94883842368416ca98269a7cf0ec [file] [log] [blame]
<!DOCTYPE html>
<title>Test that line breaks are forced in captions.</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../media-file.js"></script>
<script src="../media-controls.js"></script>
<video>
<track src="captions-webvtt/long-word.vtt" kind="captions" default>
</video>
<script>
async_test(function(t) {
var singleLineCaptionHeight;
var video = document.querySelector("video");
video.oncanplaythrough = t.step_func(function() {
// Record Single line caption height.
singleLineCaptionHeight = getCaptionLineHeight();
video.currentTime = 3;
});
video.onseeked = t.step_func_done(function() {
var multiLineCaptionHeight = getCaptionLineHeight();
assert_greater_than(multiLineCaptionHeight / singleLineCaptionHeight, 2);
});
video.src = findMediaFile("video", "../content/test");
function getCaptionLineHeight() {
var captionElement = textTrackContainerElement(video).firstChild.firstChild;
return captionElement.getBoundingClientRect().height;
}
});
</script>