summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/video_size_preserved_after_ended.html
blob: 9b2783c930ac23ba3ffe9e3b58585da31ca1f9f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<!DOCTYPE HTML>
<html>
<head>
    <title>HTML5 Media Elements: The size of the video shouldn't be lost after an 'ended' event.</title>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
    <link rel="author" title="Alicia Boya García" href="mailto:aboya@igalia.com"/>
    <script src="/resources/testharness.js"></script>
    <script src="/resources/testharnessreport.js"></script>
</head>
<body>
<video id="video">
    <source src="/media/test-1s.mp4" type="video/mp4">
    <source src="/media/test-1s.webm" type="video/webm">
</video>
<script>
    promise_test(async (test) => {
        const eventWatcher = new EventWatcher(test, video, ["loadedmetadata", "ended"]);
        await eventWatcher.wait_for("loadedmetadata");
        assert_equals(video.videoWidth, 320, "width when the video is loaded");
        assert_equals(video.videoHeight, 240, "height when the video is loaded");
        video.play();
        await eventWatcher.wait_for(["ended"]);
        assert_equals(video.videoWidth, 320, "width after playback");
        assert_equals(video.videoHeight, 240, "height after playback");
        if (video.videoTracks)
            assert_equals(video.videoTracks.length, 1);
    }, "Video dimensions are preserved at the end of the video.");
</script>
</body>
</html>