| 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 == '-1') OK | 21 EXPECTED (textCue.line == '-1') 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 == '-1') OK | 47 EXPECTED (newCue.line == '-1') 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 *** Create an old-style cue with an id. | 52 *** Create an old-style cue with an id. |
| 53 RUN(oldStyleCue = new VTTCue('sausage-cue', 33, 3.4, 'Sausage?')) | 53 RUN(oldStyleCue = new VTTCue('sausage-cue', 33, 3.4, 'Sausage?')) |
| 54 EXPECTED (oldStyleCue.id == '') OK | 54 EXPECTED (oldStyleCue.id == '') OK |
| 55 EXPECTED (oldStyleCue.startTime.toString() == 'NaN') OK | 55 EXPECTED (oldStyleCue.startTime.toString() == 'NaN') OK |
| 56 EXPECTED (oldStyleCue.endTime == '33') 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. | 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 | 58 EXPECTED (testTrack.track.cues.length == '5') OK |
| (...skipping 18 matching lines...) Expand all Loading... |
| 77 | 77 |
| 78 *** Add a cue before all the existing cues. | 78 *** Add a cue before all the existing cues. |
| 79 RUN(testTrack.track.addCue(new VTTCue(0, 31, 'I am first'))) | 79 RUN(testTrack.track.addCue(new VTTCue(0, 31, 'I am first'))) |
| 80 EXPECTED (cues[0].startTime == '0') OK | 80 EXPECTED (cues[0].startTime == '0') OK |
| 81 EXPECTED (cues[0].endTime == '31') OK | 81 EXPECTED (cues[0].endTime == '31') OK |
| 82 EXPECTED (cues[1].startTime == '0') OK | 82 EXPECTED (cues[1].startTime == '0') OK |
| 83 EXPECTED (cues[1].endTime == '30.5') OK | 83 EXPECTED (cues[1].endTime == '30.5') OK |
| 84 EXPECTED (cues[2].startTime == '31') OK | 84 EXPECTED (cues[2].startTime == '31') OK |
| 85 END OF TEST | 85 END OF TEST |
| 86 | 86 |
| OLD | NEW |