OLD | NEW |
1 Tests TextTrack's addCue and removeCue | 1 Tests TextTrack's addCue and removeCue |
2 | 2 |
3 | 3 |
4 *** Test cues loaded from the file. | 4 *** Test cues loaded from the file. |
5 EXPECTED (cues.length == '4') OK | 5 EXPECTED (cues.length == '4') OK |
6 EXPECTED (cues.getCueById('1').startTime == '0') OK | 6 EXPECTED (cues.getCueById('1').startTime == '0') OK |
7 EXPECTED (cues[1].startTime == '31') OK | 7 EXPECTED (cues[1].startTime == '31') OK |
8 EXPECTED (cues[2].startTime == '61') OK | 8 EXPECTED (cues[2].startTime == '61') OK |
9 EXPECTED (cues.getCueById('4').startTime == '121') OK | 9 EXPECTED (cues.getCueById('4').startTime == '121') OK |
10 EXPECTED (cues.getCueById('junk') == 'undefined') OK | 10 EXPECTED (cues.getCueById('junk') == 'undefined') OK |
11 | 11 |
12 *** Create a new cue, check values | 12 *** Create a new cue, check values |
13 RUN(textCue = new VTTCue(33, 3.4, 'Sausage?')) | 13 RUN(textCue = new VTTCue(33, 3.4, 'Sausage?')) |
14 EXPECTED (textCue.track == 'null') OK | 14 EXPECTED (textCue.track == 'null') OK |
15 EXPECTED (textCue.id == '') OK | 15 EXPECTED (textCue.id == '') OK |
16 EXPECTED (textCue.startTime == '33') OK | 16 EXPECTED (textCue.startTime == '33') OK |
17 EXPECTED (textCue.endTime == '3.4') OK | 17 EXPECTED (textCue.endTime == '3.4') OK |
18 EXPECTED (textCue.pauseOnExit == 'false') OK | 18 EXPECTED (textCue.pauseOnExit == 'false') OK |
19 EXPECTED (textCue.vertical == '') OK | 19 EXPECTED (textCue.vertical == '') OK |
20 EXPECTED (textCue.snapToLines == 'true') OK | 20 EXPECTED (textCue.snapToLines == 'true') OK |
21 EXPECTED (textCue.line == 'auto') OK | 21 EXPECTED (textCue.line == 'auto') OK |
22 EXPECTED (textCue.position == '50') OK | 22 EXPECTED (textCue.position == 'auto') OK |
23 EXPECTED (textCue.size == '100') OK | 23 EXPECTED (textCue.size == '100') OK |
24 EXPECTED (textCue.align == 'middle') OK | 24 EXPECTED (textCue.align == 'middle') OK |
25 | 25 |
26 *** Remove the unadded track, make sure it throws correctly. | 26 *** Remove the unadded track, make sure it throws correctly. |
27 TEST(testTrack.track.removeCue(textCue)) THROWS("NotFoundError: Failed to execut
e 'removeCue' on 'TextTrack': The specified cue is not listed in the TextTrack's
list of cues.") OK | 27 TEST(testTrack.track.removeCue(textCue)) THROWS("NotFoundError: Failed to execut
e 'removeCue' on 'TextTrack': The specified cue is not listed in the TextTrack's
list of cues.") OK |
28 | 28 |
29 *** Add the new cue to a track, make sure it is inserted correctly. | 29 *** Add the new cue to a track, make sure it is inserted correctly. |
30 RUN(testTrack.track.addCue(textCue)) | 30 RUN(testTrack.track.addCue(textCue)) |
31 EXPECTED (textCue.track == '[object TextTrack]') OK | 31 EXPECTED (textCue.track == '[object TextTrack]') OK |
32 EXPECTED (cues[1].startTime == '31') OK | 32 EXPECTED (cues[1].startTime == '31') OK |
33 EXPECTED (cues[2].startTime == '33') OK | 33 EXPECTED (cues[2].startTime == '33') OK |
34 EXPECTED (cues[3].startTime == '61') OK | 34 EXPECTED (cues[3].startTime == '61') OK |
35 | 35 |
36 *** create a new cue and add it to a track created with video.addTextTrack, make
sure it is inserted correctly. | 36 *** create a new cue and add it to a track created with video.addTextTrack, make
sure it is inserted correctly. |
37 RUN(newTrack = video.addTextTrack("subtitles", "French subtitles", "fr")) | 37 RUN(newTrack = video.addTextTrack("subtitles", "French subtitles", "fr")) |
38 RUN(newTrack.addCue(new VTTCue(0.0, 1.0, "Test!"))) | 38 RUN(newTrack.addCue(new VTTCue(0.0, 1.0, "Test!"))) |
39 RUN(newCue = newTrack.cues[0]) | 39 RUN(newCue = newTrack.cues[0]) |
40 EXPECTED (newCue.track == '[object TextTrack]') OK | 40 EXPECTED (newCue.track == '[object TextTrack]') OK |
41 EXPECTED (newCue.id == '') OK | 41 EXPECTED (newCue.id == '') OK |
42 EXPECTED (newCue.startTime == '0') OK | 42 EXPECTED (newCue.startTime == '0') OK |
43 EXPECTED (newCue.endTime == '1') OK | 43 EXPECTED (newCue.endTime == '1') OK |
44 EXPECTED (newCue.pauseOnExit == 'false') OK | 44 EXPECTED (newCue.pauseOnExit == 'false') OK |
45 EXPECTED (newCue.vertical == '') OK | 45 EXPECTED (newCue.vertical == '') OK |
46 EXPECTED (newCue.snapToLines == 'true') OK | 46 EXPECTED (newCue.snapToLines == 'true') OK |
47 EXPECTED (newCue.line == 'auto') OK | 47 EXPECTED (newCue.line == 'auto') OK |
48 EXPECTED (newCue.position == '50') OK | 48 EXPECTED (newCue.position == 'auto') OK |
49 EXPECTED (newCue.size == '100') OK | 49 EXPECTED (newCue.size == '100') OK |
50 EXPECTED (newCue.align == 'middle') OK | 50 EXPECTED (newCue.align == 'middle') OK |
51 | 51 |
52 *** Remove a cue created with addCue(). | 52 *** Remove a cue created with addCue(). |
53 RUN(testTrack.track.removeCue(textCue)) | 53 RUN(testTrack.track.removeCue(textCue)) |
54 EXPECTED (textCue.track == 'null') OK | 54 EXPECTED (textCue.track == 'null') OK |
55 EXPECTED (cues[1].startTime == '31') OK | 55 EXPECTED (cues[1].startTime == '31') OK |
56 EXPECTED (cues[2].startTime == '61') OK | 56 EXPECTED (cues[2].startTime == '61') OK |
57 | 57 |
58 *** Remove a cue added from the WebVTT file. | 58 *** Remove a cue added from the WebVTT file. |
59 RUN(textCue = cues[2]) | 59 RUN(textCue = cues[2]) |
60 RUN(testTrack.track.removeCue(textCue)) | 60 RUN(testTrack.track.removeCue(textCue)) |
61 EXPECTED (textCue.track == 'null') OK | 61 EXPECTED (textCue.track == 'null') OK |
62 EXPECTED (cues[1].startTime == '31') OK | 62 EXPECTED (cues[1].startTime == '31') OK |
63 EXPECTED (cues[2].startTime == '121') OK | 63 EXPECTED (cues[2].startTime == '121') OK |
64 | 64 |
65 *** Try to remove the cue again. | 65 *** Try to remove the cue again. |
66 TEST(testTrack.track.removeCue(textCue)) THROWS(DOMException.NOT_FOUND_ERR: Fail
ed to execute 'removeCue' on 'TextTrack': The specified cue is not listed in the
TextTrack's list of cues.) OK | 66 TEST(testTrack.track.removeCue(textCue)) THROWS(DOMException.NOT_FOUND_ERR: Fail
ed to execute 'removeCue' on 'TextTrack': The specified cue is not listed in the
TextTrack's list of cues.) OK |
67 | 67 |
68 *** Add a cue before all the existing cues. | 68 *** Add a cue before all the existing cues. |
69 RUN(testTrack.track.addCue(new VTTCue(0, 31, 'I am first'))) | 69 RUN(testTrack.track.addCue(new VTTCue(0, 31, 'I am first'))) |
70 EXPECTED (cues[0].startTime == '0') OK | 70 EXPECTED (cues[0].startTime == '0') OK |
71 EXPECTED (cues[0].endTime == '31') OK | 71 EXPECTED (cues[0].endTime == '31') OK |
72 EXPECTED (cues[1].startTime == '0') OK | 72 EXPECTED (cues[1].startTime == '0') OK |
73 EXPECTED (cues[1].endTime == '30.5') OK | 73 EXPECTED (cues[1].endTime == '30.5') OK |
74 EXPECTED (cues[2].startTime == '31') OK | 74 EXPECTED (cues[2].startTime == '31') OK |
75 END OF TEST | 75 END OF TEST |
76 | 76 |
OLD | NEW |