blob: d6851a07a4f0652d04e8d7ab04e1b1f39a9d1388 [file] [log] [blame]
Tests that TextTracks in a TextTrackList are kept in the correct order.
** Add a track with video.addTextTrack().
RUN(video.addTextTrack('descriptions', 'Descriptions Track', 'en'))
** Add a <track> element with DOM API.
RUN(trackElement = document.createElement('track'))
RUN(trackElement.setAttribute('kind', 'chapters'))
RUN(video.appendChild(trackElement))
** Verify track order.
EXPECTED (video.textTracks.length == '3') OK
EXPECTED (video.textTracks[0].kind == 'captions') OK
EXPECTED (video.textTracks[1].kind == 'chapters') OK
EXPECTED (video.textTracks[2].kind == 'descriptions') OK
** Verify the default parameters of the text track object returned by addTextTrack(). **
EXPECTED (video.textTracks[2].mode == 'hidden' == 'true') OK
EXPECTED (video.textTracks[2].cues != null == 'true') OK
EXPECTED (video.textTracks[2].cues.length == 0 == 'true') OK
** Add another <track> element, is should insert before the addTextTrack() track.
RUN(trackElement = document.createElement('track'))
RUN(trackElement.setAttribute('kind', 'metadata'))
RUN(video.appendChild(trackElement))
EXPECTED (video.textTracks.length == '4') OK
EXPECTED (video.textTracks[0].kind == 'captions') OK
EXPECTED (video.textTracks[1].kind == 'chapters') OK
EXPECTED (video.textTracks[2].kind == 'metadata') OK
EXPECTED (video.textTracks[3].kind == 'descriptions') OK
END OF TEST