-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WebVTT] Cues should use white-space:pre-line [WPT][WebVTT] Move some WebVTT rendering tests into the correct location https://bugs.webkit.org/show_bug.cgi?id=275616 https://bugs.webkit.org/show_bug.cgi?id=280436
- Loading branch information
Showing
8 changed files
with
171 additions
and
0 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
webvtt/rendering/cues-with-video/processing-model/basic-cue-rendering-expected.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title>webvtt-white-space-pre-line-expected</title> | ||
<link rel="stylesheet" type="text/css" href="support/reference.css"> | ||
<body> | ||
<div>Test rendering a basic <code>VTTCue</code>.</div> | ||
<div class="test-diff"> | ||
<video-reference expected> | ||
<cue style="width: 100%; left: 0; bottom: 0px;"> | ||
<cue-background style="margin: auto">Test Text</cue-background> | ||
</cue> | ||
</video-reference> | ||
<video-reference> | ||
<cue style="width: 100%; left: 0; bottom: 0px;"> | ||
<cue-background style="margin: auto">Test Text</cue-background> | ||
</cue> | ||
</video-reference> | ||
</div> | ||
</body> | ||
</html> |
25 changes: 25 additions & 0 deletions
25
webvtt/rendering/cues-with-video/processing-model/basic-cue-rendering.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!DOCTYPE html> | ||
<html class="reftest-wait"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title>webvtt-white-space-pre-line</title> | ||
<link rel="stylesheet" type="text/css" href="support/reference.css"> | ||
<script src="/common/reftest-wait.js"></script> | ||
<script src="support/webvtt-rendering-test.js"></script> | ||
<body> | ||
<div>Test rendering a basic <code>VTTCue</code>.</div> | ||
<div class="test-diff"> | ||
<video-reference expected> | ||
<cue style="width: 100%; left: 0; bottom: 0px;"> | ||
<cue-background style="margin: auto">Test Text</cue-background> | ||
</cue> | ||
</video-reference> | ||
<video muted playsinline> | ||
<source src="/media/sound_5.mp3#t=0.05" type="audio/mp3"> | ||
<source src="/media/sound_5.oga#t=0.05" type="audio/ogg"> | ||
<track src="support/basic-cue-rendering.webvtt" kind="captions" default> | ||
</video> | ||
</div> | ||
</body> | ||
</html> |
4 changes: 4 additions & 0 deletions
4
webvtt/rendering/cues-with-video/processing-model/support/basic-cue-rendering.webvtt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
WEBVTT | ||
|
||
00:00:00.000 --> 00:00:00.100 | ||
Test Text |
47 changes: 47 additions & 0 deletions
47
webvtt/rendering/cues-with-video/processing-model/support/reference.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
@font-face { | ||
font-family: 'ahem'; | ||
src: url('/fonts/Ahem.ttf'); | ||
} | ||
|
||
.test-diff { | ||
container-type: inline-size; | ||
width: 200px; | ||
height: 200px; | ||
display: inline-block; | ||
isolation: isolate; | ||
position: relative; | ||
border: 1px solid black; | ||
} | ||
|
||
video-reference, cue { display: inline-block; } | ||
cue-background { display: inline; } | ||
|
||
video, video-reference { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
mix-blend-mode: difference; | ||
} | ||
|
||
::cue, cue { | ||
font: 5cqmin/1 Ahem; | ||
} | ||
|
||
::cue, cue-background { | ||
color: rgb(128, 0, 0); | ||
background-color: rgb(255, 0, 0); | ||
} | ||
|
||
cue { | ||
position: absolute; | ||
display: inline-block; | ||
text-align: center; | ||
white-space: pre-line; | ||
} | ||
|
||
video-reference[expected] > cue > cue-background { | ||
color: rgb(128, 128, 0); | ||
background-color: rgb(255, 255, 0); | ||
} |
21 changes: 21 additions & 0 deletions
21
webvtt/rendering/cues-with-video/processing-model/support/webvtt-rendering-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
window.addEventListener('load', async event => { | ||
if (!document.documentElement.classList.contains('reftest-wait')) | ||
return; | ||
|
||
let waitFor = (object, type) => { | ||
return new Promise(resolve => { | ||
object.addEventListener(type, resolve); | ||
}, { once: true }); | ||
}; | ||
|
||
let trackElement = document.querySelector('video > track[default]'); | ||
if (!trackElement) | ||
return; | ||
|
||
if (trackElement.track.mode !== 'showing') | ||
trackElement.track.mode = 'showing'; | ||
if (!trackElement.track.activeCues) | ||
await waitFor(trackElement.track, 'cuechange'); | ||
|
||
document.documentElement.classList.remove('reftest-wait'); | ||
}); |
4 changes: 4 additions & 0 deletions
4
webvtt/rendering/cues-with-video/processing-model/support/white-space-pre-line.webvtt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
WEBVTT | ||
|
||
00:00:00.000 --> 00:00:00.100 size:40% | ||
Test Text |
23 changes: 23 additions & 0 deletions
23
webvtt/rendering/cues-with-video/processing-model/white-space-pre-line-expected.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title>webvtt-white-space-pre-line</title> | ||
<link rel="stylesheet" type="text/css" href="support/reference.css"> | ||
<body> | ||
<div>Test rendering of wrapped text when <code>white-space: pre-line</code> is set.</div> | ||
<div class="test-diff"> | ||
<video-reference expected> | ||
<cue style="width: 40%; left: 30%; bottom: 0px;"> | ||
<cue-background style="margin: auto">Test Text</cue-background> | ||
</cue> | ||
</video-reference> | ||
<video-reference> | ||
<cue style="width: 40%; left: 30%; bottom: 0px;"> | ||
<cue-background style="margin: auto">Test Text</cue-background> | ||
</cue> | ||
</video-reference> | ||
</div> | ||
</body> | ||
</html> |
24 changes: 24 additions & 0 deletions
24
webvtt/rendering/cues-with-video/processing-model/white-space-pre-line.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<!DOCTYPE html> | ||
<html class="reftest-wait"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title>webvtt-white-space-pre-line</title> | ||
<link rel="stylesheet" type="text/css" href="support/reference.css"> | ||
<script src="support/webvtt-rendering-test.js"></script> | ||
<body> | ||
<div>Test rendering of wrapped text when <code>white-space: pre-line</code> is set.</div> | ||
<div class="test-diff"> | ||
<video-reference expected> | ||
<cue style="width: 40%; left: 30%; bottom: 0px;"> | ||
<cue-background style="margin: auto">Test Text</cue-background> | ||
</cue> | ||
</video-reference> | ||
<video muted playsinline> | ||
<source src="/media/sound_5.mp3#t=0.05" type="audio/mp3"> | ||
<source src="/media/sound_5.oga#t=0.05" type="audio/ogg"> | ||
<track src="support/white-space-pre-line.webvtt" kind="captions" default> | ||
</video> | ||
</div> | ||
</body> | ||
</html> |