diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /dom/media/webvtt/test/reftest | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/media/webvtt/test/reftest')
-rw-r--r-- | dom/media/webvtt/test/reftest/black.mp4 | bin | 0 -> 15036 bytes | |||
-rw-r--r-- | dom/media/webvtt/test/reftest/cues_time_overlapping.webvtt | 7 | ||||
-rw-r--r-- | dom/media/webvtt/test/reftest/reftest.list | 3 | ||||
-rw-r--r-- | dom/media/webvtt/test/reftest/vtt_overlapping_time-ref.html | 29 | ||||
-rw-r--r-- | dom/media/webvtt/test/reftest/vtt_overlapping_time.html | 30 | ||||
-rw-r--r-- | dom/media/webvtt/test/reftest/vtt_reflow_display-ref.html | 28 | ||||
-rw-r--r-- | dom/media/webvtt/test/reftest/vtt_reflow_display.css | 33 | ||||
-rw-r--r-- | dom/media/webvtt/test/reftest/vtt_reflow_display.html | 37 | ||||
-rw-r--r-- | dom/media/webvtt/test/reftest/vtt_update_display_after_removed_cue.html | 36 | ||||
-rw-r--r-- | dom/media/webvtt/test/reftest/vtt_update_display_after_removed_cue_ref.html | 6 | ||||
-rw-r--r-- | dom/media/webvtt/test/reftest/white.webm | bin | 0 -> 10880 bytes |
11 files changed, 209 insertions, 0 deletions
diff --git a/dom/media/webvtt/test/reftest/black.mp4 b/dom/media/webvtt/test/reftest/black.mp4 Binary files differnew file mode 100644 index 0000000000..24eb3be139 --- /dev/null +++ b/dom/media/webvtt/test/reftest/black.mp4 diff --git a/dom/media/webvtt/test/reftest/cues_time_overlapping.webvtt b/dom/media/webvtt/test/reftest/cues_time_overlapping.webvtt new file mode 100644 index 0000000000..8ed899a9d8 --- /dev/null +++ b/dom/media/webvtt/test/reftest/cues_time_overlapping.webvtt @@ -0,0 +1,7 @@ +WEBVTT FILE + +00:00:00.000 --> 00:00:01.000 +First cue + +00:00:00.000 --> 00:00:04.000 +Second cue diff --git a/dom/media/webvtt/test/reftest/reftest.list b/dom/media/webvtt/test/reftest/reftest.list new file mode 100644 index 0000000000..8311bac10f --- /dev/null +++ b/dom/media/webvtt/test/reftest/reftest.list @@ -0,0 +1,3 @@ +skip-if(Android) fuzzy-if(/^Windows\x20NT\x2010\.0/.test(http.oscpu)&&/^aarch64-msvc/.test(xulRuntime.XPCOMABI),0-136,0-427680) == vtt_update_display_after_removed_cue.html vtt_update_display_after_removed_cue_ref.html +skip-if(Android) fuzzy-if(winWidget,0-170,0-170) == vtt_overlapping_time.html vtt_overlapping_time-ref.html +skip-if(Android) != vtt_reflow_display.html vtt_reflow_display-ref.html diff --git a/dom/media/webvtt/test/reftest/vtt_overlapping_time-ref.html b/dom/media/webvtt/test/reftest/vtt_overlapping_time-ref.html new file mode 100644 index 0000000000..a44e24678b --- /dev/null +++ b/dom/media/webvtt/test/reftest/vtt_overlapping_time-ref.html @@ -0,0 +1,29 @@ +<!DOCTYPE HTML> +<html class="reftest-wait"> +<head> +</head> +<body> +<video id="v1" src="black.mp4" width="320" height="180"> + <track label="English" src="cues_time_overlapping.webvtt" default> +</video> +<script type="text/javascript"> +/** + * This test is to ensure that when cues with overlapping times, the one with + * earlier end timestamp should disappear when the media time reaches its + * end time. This vtt file contains two cues, the first cue is [0,1], the second + * cue is [0,4], so if we seek video to 2s, only cue2 should be displayed. + */ +async function testTimeOverlappingCues() { + const video = document.getElementById("v1"); + video.currentTime = 2; + video.onseeked = () => { + video.onseeked = null; + document.documentElement.removeAttribute('class'); + } +}; + +window.addEventListener("MozReftestInvalidate", + testTimeOverlappingCues); +</script> +</body> +</html> diff --git a/dom/media/webvtt/test/reftest/vtt_overlapping_time.html b/dom/media/webvtt/test/reftest/vtt_overlapping_time.html new file mode 100644 index 0000000000..f973b398d5 --- /dev/null +++ b/dom/media/webvtt/test/reftest/vtt_overlapping_time.html @@ -0,0 +1,30 @@ +<!DOCTYPE HTML> +<html class="reftest-wait"> +<head> +</head> +<body> +<video id="v1" src="black.mp4" autoplay width="320" height="180"> + <track label="English" src="cues_time_overlapping.webvtt" default> +</video> +<script type="text/javascript"> +/** + * This test is to ensure that when cues with overlapping times, the one with + * earlier end timestamp should disappear when the media time reaches its + * end time. This vtt file contains two cues, the first cue is [0,1], the second + * cue is [0,4], so after video is playing over 1s, only cue2 should be displayed. + */ +async function testTimeOverlappingCues() { + const video = document.getElementById("v1"); + video.ontimeupdate = () => { + if (video.currentTime > 1.0) { + document.documentElement.removeAttribute('class'); + video.ontimeupdate = null; + } + } +}; + +window.addEventListener("MozReftestInvalidate", + testTimeOverlappingCues); +</script> +</body> +</html> diff --git a/dom/media/webvtt/test/reftest/vtt_reflow_display-ref.html b/dom/media/webvtt/test/reftest/vtt_reflow_display-ref.html new file mode 100644 index 0000000000..19f3208e6b --- /dev/null +++ b/dom/media/webvtt/test/reftest/vtt_reflow_display-ref.html @@ -0,0 +1,28 @@ +<!DOCTYPE HTML> +<html> +<link rel="stylesheet" href="vtt_reflow_display.css"> +<body> +<div class="video-player"> + <div class="video-layer"> + <video id="v1" autoplay controls></video> + </div> +</div> +<script> +/** + * Simply play and pause a video without any cues. + */ +async function testDisplayCueDuringFrequentReflowRef() { + const video = document.getElementById("v1"); + video.src = "white.webm"; + video.onplay = _ => { + video.onplay = null; + video.pause(); + document.documentElement.removeAttribute('class'); + } +}; + +window.addEventListener("MozReftestInvalidate", + testDisplayCueDuringFrequentReflowRef); +</script> +</body> +</html> diff --git a/dom/media/webvtt/test/reftest/vtt_reflow_display.css b/dom/media/webvtt/test/reftest/vtt_reflow_display.css new file mode 100644 index 0000000000..4b66a07bd4 --- /dev/null +++ b/dom/media/webvtt/test/reftest/vtt_reflow_display.css @@ -0,0 +1,33 @@ +body { + display: flex; + flex-direction: column; + align-items: center; + max-height: 100%; + width: 100vw; + height: 100vh; +} +.video-player { + display: flex; + max-height: calc(100% - 400px); + flex: 1 1 0; + flex-direction: column; + position: relative; + max-width: 100%; + height: 0; +} +.video-layer { + position: relative; + display: flex; + flex-direction: column; + width: 100%; + height: 100%; + flex: 1 1 0; +} +video { + object-fit: contain; + display: flex; + flex: auto; + max-width: 100%; + min-height: 0; + min-width: 0; +} diff --git a/dom/media/webvtt/test/reftest/vtt_reflow_display.html b/dom/media/webvtt/test/reftest/vtt_reflow_display.html new file mode 100644 index 0000000000..e7ec496bc1 --- /dev/null +++ b/dom/media/webvtt/test/reftest/vtt_reflow_display.html @@ -0,0 +1,37 @@ +<!DOCTYPE HTML> +<html class="reftest-wait"> +<head> +</head> +<link rel="stylesheet" href="vtt_reflow_display.css"> +<body> +<div class="video-player"> + <div class="video-layer"> + <video id="v1" autoplay controls></video> + </div> +</div> +<script> +/** + * In bug 1733232, setting some CSS properties (from bug 1733232 comment17) + * would cause video frame's reflow called very frequently, which crashed the + * video control and caused no cue showing. We compare this test with another + * white video without any cues, and they should NOT be equal. + */ +function testDisplayCueDuringFrequentReflow() { + let video = document.getElementById("v1"); + video.src = "white.webm"; + let cue = new VTTCue(0, 4, "hello testing"); + cue.onenter = _ => { + cue.onenter = null; + video.pause(); + document.documentElement.removeAttribute('class'); + } + let track = video.addTextTrack("captions"); + track.mode = "showing"; + track.addCue(cue); +}; + +window.addEventListener("MozReftestInvalidate", + testDisplayCueDuringFrequentReflow); +</script> +</body> +</html> diff --git a/dom/media/webvtt/test/reftest/vtt_update_display_after_removed_cue.html b/dom/media/webvtt/test/reftest/vtt_update_display_after_removed_cue.html new file mode 100644 index 0000000000..4cd5d5bbd2 --- /dev/null +++ b/dom/media/webvtt/test/reftest/vtt_update_display_after_removed_cue.html @@ -0,0 +1,36 @@ +<!DOCTYPE HTML> +<html class="reftest-wait"> +<head> +</head> +<body> +<video id="v1" autoplay></video> +<script type="text/javascript"> + +/** + * This test is used to ensure we would update the cue display after removing + * cue from the text track, the removed cue should not display on the video's + * rendering area. + */ +function testUpdateDisplayAfterRemovedCue() { + let video = document.getElementById("v1"); + video.src = "black.mp4"; + let cue = new VTTCue(0, 4, "hello testing"); + let track = video.addTextTrack("captions"); + track.mode = "showing"; + track.addCue(cue); + cue.onenter = () => { + cue.onenter = null; + track.removeCue(cue); + video.pause(); + video.onpause = () => { + video.onpause = null; + document.documentElement.removeAttribute('class'); + } + } +}; + +window.addEventListener("MozReftestInvalidate", + testUpdateDisplayAfterRemovedCue); +</script> +</body> +</html> diff --git a/dom/media/webvtt/test/reftest/vtt_update_display_after_removed_cue_ref.html b/dom/media/webvtt/test/reftest/vtt_update_display_after_removed_cue_ref.html new file mode 100644 index 0000000000..0b1afdc568 --- /dev/null +++ b/dom/media/webvtt/test/reftest/vtt_update_display_after_removed_cue_ref.html @@ -0,0 +1,6 @@ +<!DOCTYPE HTML> +<html> +<body> +<video id="v1" src="black.mp4"></video> +</body> +</html> diff --git a/dom/media/webvtt/test/reftest/white.webm b/dom/media/webvtt/test/reftest/white.webm Binary files differnew file mode 100644 index 0000000000..bbacad7ffd --- /dev/null +++ b/dom/media/webvtt/test/reftest/white.webm |