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 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 == '-1') OK | 47 EXPECTED (newCue.line == '-1') OK |
48 EXPECTED (newCue.position == '50') OK | 48 EXPECTED (newCue.position == '50') 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 *** Create an old-style cue with an id. | |
53 RUN(oldStyleCue = new VTTCue('sausage-cue', 33, 3.4, 'Sausage?')) | |
54 EXPECTED (oldStyleCue.id == '') OK | |
55 EXPECTED (oldStyleCue.startTime.toString() == 'NaN') OK | |
56 EXPECTED (oldStyleCue.endTime == '33') OK | |
57 *** Make sure the old-style cue is not inserted because its start time is not a
number. | |
58 EXPECTED (testTrack.track.cues.length == '5') OK | |
59 RUN(testTrack.track.addCue(oldStyleCue)) | |
60 EXPECTED (testTrack.track.cues.length == '5') OK | |
61 | |
62 *** Remove a cue created with addCue(). | 52 *** Remove a cue created with addCue(). |
63 RUN(testTrack.track.removeCue(textCue)) | 53 RUN(testTrack.track.removeCue(textCue)) |
64 EXPECTED (textCue.track == 'null') OK | 54 EXPECTED (textCue.track == 'null') OK |
65 EXPECTED (cues[1].startTime == '31') OK | 55 EXPECTED (cues[1].startTime == '31') OK |
66 EXPECTED (cues[2].startTime == '61') OK | 56 EXPECTED (cues[2].startTime == '61') OK |
67 | 57 |
68 *** Remove a cue added from the WebVTT file. | 58 *** Remove a cue added from the WebVTT file. |
69 RUN(textCue = cues[2]) | 59 RUN(textCue = cues[2]) |
70 RUN(testTrack.track.removeCue(textCue)) | 60 RUN(testTrack.track.removeCue(textCue)) |
71 EXPECTED (textCue.track == 'null') OK | 61 EXPECTED (textCue.track == 'null') OK |
72 EXPECTED (cues[1].startTime == '31') OK | 62 EXPECTED (cues[1].startTime == '31') OK |
73 EXPECTED (cues[2].startTime == '121') OK | 63 EXPECTED (cues[2].startTime == '121') OK |
74 | 64 |
75 *** Try to remove the cue again. | 65 *** Try to remove the cue again. |
76 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 |
77 | 67 |
78 *** Add a cue before all the existing cues. | 68 *** Add a cue before all the existing cues. |
79 RUN(testTrack.track.addCue(new VTTCue(0, 31, 'I am first'))) | 69 RUN(testTrack.track.addCue(new VTTCue(0, 31, 'I am first'))) |
80 EXPECTED (cues[0].startTime == '0') OK | 70 EXPECTED (cues[0].startTime == '0') OK |
81 EXPECTED (cues[0].endTime == '31') OK | 71 EXPECTED (cues[0].endTime == '31') OK |
82 EXPECTED (cues[1].startTime == '0') OK | 72 EXPECTED (cues[1].startTime == '0') OK |
83 EXPECTED (cues[1].endTime == '30.5') OK | 73 EXPECTED (cues[1].endTime == '30.5') OK |
84 EXPECTED (cues[2].startTime == '31') OK | 74 EXPECTED (cues[2].startTime == '31') OK |
85 END OF TEST | 75 END OF TEST |
86 | 76 |
OLD | NEW |