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/mochitest/test_bug883173.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-upstream.tar.xz firefox-esr-upstream.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/media/webvtt/test/mochitest/test_bug883173.html')
-rw-r--r-- | dom/media/webvtt/test/mochitest/test_bug883173.html | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/dom/media/webvtt/test/mochitest/test_bug883173.html b/dom/media/webvtt/test/mochitest/test_bug883173.html new file mode 100644 index 0000000000..6e95f4e3ca --- /dev/null +++ b/dom/media/webvtt/test/mochitest/test_bug883173.html @@ -0,0 +1,39 @@ +<!DOCTYPE HTML> +<html> +<head> + <title>Test for Bug 883173 - TextTrackCue(List) Sorting</title> + <script src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> +</head> +<body> +<video id="v" src="seek.webm" preload="metadata"> + <track src="bug883173.vtt" kind="subtitles" id="default" default> +</video> +<script type="text/javascript"> +/** + * This test is used to ensure that the cues in the cue list should be sorted by + * cues' start time and end time, not the present order in the file. + */ +function runTest() { + let trackElement = document.getElementById("default"); + is(trackElement.readyState, 2, "Track::ReadyState should be set to LOADED."); + + let expected = [[1, 3], [1, 2], [2, 4], [2, 3], [3, 4]]; + let cueList = trackElement.track.cues; + is(cueList.length, expected.length, "Cue list length should be 5."); + + for (let i = 0; i < expected.length; i++) { + is(cueList[i].startTime, expected[i][0], + `Cue's start time should be ${expected[i][0]}`); + is(cueList[i].endTime, expected[i][1], + `Cue's end time should be ${expected[i][1]}`); + } + + SimpleTest.finish(); +} + +SimpleTest.waitForExplicitFinish(); +onload = runTest; +</script> +</body> +</html> |