File: endTime.html

package info (click to toggle)
thunderbird 1%3A140.4.0esr-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,609,432 kB
  • sloc: cpp: 7,672,442; javascript: 5,901,613; ansic: 3,898,954; python: 1,413,343; xml: 653,997; asm: 462,286; java: 180,927; sh: 113,489; makefile: 20,460; perl: 14,288; objc: 13,059; yacc: 4,583; pascal: 3,352; lex: 1,720; ruby: 1,222; exp: 762; sql: 715; awk: 580; php: 436; lisp: 430; sed: 70; csh: 10
file content (40 lines) | stat: -rw-r--r-- 1,442 bytes parent folder | download | duplicates (23)
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
31
32
33
34
35
36
37
38
39
40
<!doctype html>
<title>TextTrackCue.endTime</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
<script>
setup(function(){
    window.video = document.createElement('video');
    window.t1 = video.addTextTrack('subtitles');
    document.body.appendChild(video);
});
test(function(){
    var c1 = new VTTCue(-2, -1, 'text1');
    assert_equals(c1.endTime, -1);
    c1.endTime = c1.endTime;
    assert_equals(c1.endTime, -1);
    assert_throws_js(TypeError, function(){ c1.endTime = NaN; });
    c1.endTime = +Infinity;
    assert_equals(c1.endTime, +Infinity);
    assert_throws_js(TypeError, function(){ c1.endTime = -Infinity; });
}, document.title+', script-created cue');

var t_parsed = async_test(document.title+', parsed cue');
t_parsed.step(function(){
    var t = document.createElement('track');
    t.onload = this.step_func(function(){
        var c = t.track.cues;
        assert_equals(c[0].endTime, 0.001);
        assert_equals(c[1].endTime, 3600.001);
        this.done();
    });
    t.onerror = this.step_func(function() {
      assert_unreached('got error event');
    });
    t.src = 'data:text/vtt,'+encodeURIComponent('WEBVTT\n\n00:00:00.000 --> 00:00:00.001\ntest'+
                                                      '\n\nfoobar\n01:00:00.000 --> 01:00:00.001\ntest');
    t.track.mode = 'showing';
    video.appendChild(t);
});
</script>