blob: d4255c32f2a5975c6bb90193b7be62c5deb47f02 [file] [log] [blame]
Tests that the 'kind' attribute is set properly and that cues are only visible when 'kind' is set to 'captions' or 'subtitles'.
++ Test default attribute value
EXPECTED (trackElement.getAttribute('kind') == 'null') OK
EXPECTED (trackElement.kind == 'subtitles') OK
EXPECTED (video.textTracks[0].kind == 'subtitles') OK
*** Set to bogus value, should return default
set via DOM
RUN(trackElement.removeAttribute('kind'))
RUN(trackElement.kind = 'english-metadata')
EXPECTED (trackElement.getAttribute('kind') == 'english-metadata') OK
EXPECTED (trackElement.kind == 'metadata') OK
EXPECTED (trackElement.track.kind == 'metadata') OK
and via attribute
RUN(trackElement.removeAttribute('kind'))
RUN(trackElement.setAttribute('kind', 'english-metadata'))
EXPECTED (trackElement.kind == 'metadata') OK
EXPECTED (trackElement.track.kind == 'metadata') OK
EXPECTED (trackElement.getAttribute('kind') == 'english-metadata') OK
RUN(trackElement.removeAttribute('kind'))
EXPECTED (trackElement.kind == 'subtitles') OK
EXPECTED (video.textTracks[0].kind == 'subtitles') OK
*** Set to known values
++ 'subtitles'
set via DOM
RUN(trackElement.removeAttribute('kind'))
RUN(trackElement.kind = 'subtitles')
EXPECTED (trackElement.getAttribute('kind') == 'subtitles') OK
EXPECTED (trackElement.kind == 'subtitles') OK
EXPECTED (trackElement.track.kind == 'subtitles') OK
and via attribute
RUN(trackElement.removeAttribute('kind'))
RUN(trackElement.setAttribute('kind', 'subtitles'))
EXPECTED (trackElement.kind == 'subtitles') OK
EXPECTED (trackElement.track.kind == 'subtitles') OK
EXPECTED (trackElement.getAttribute('kind') == 'subtitles') OK
++ 'captions'
set via DOM
RUN(trackElement.removeAttribute('kind'))
RUN(trackElement.kind = 'captions')
EXPECTED (trackElement.getAttribute('kind') == 'captions') OK
EXPECTED (trackElement.kind == 'captions') OK
EXPECTED (trackElement.track.kind == 'captions') OK
and via attribute
RUN(trackElement.removeAttribute('kind'))
RUN(trackElement.setAttribute('kind', 'captions'))
EXPECTED (trackElement.kind == 'captions') OK
EXPECTED (trackElement.track.kind == 'captions') OK
EXPECTED (trackElement.getAttribute('kind') == 'captions') OK
++ 'descriptions'
set via DOM
RUN(trackElement.removeAttribute('kind'))
RUN(trackElement.kind = 'descriptions')
EXPECTED (trackElement.getAttribute('kind') == 'descriptions') OK
EXPECTED (trackElement.kind == 'descriptions') OK
EXPECTED (trackElement.track.kind == 'descriptions') OK
and via attribute
RUN(trackElement.removeAttribute('kind'))
RUN(trackElement.setAttribute('kind', 'descriptions'))
EXPECTED (trackElement.kind == 'descriptions') OK
EXPECTED (trackElement.track.kind == 'descriptions') OK
EXPECTED (trackElement.getAttribute('kind') == 'descriptions') OK
++ 'chapters'
set via DOM
RUN(trackElement.removeAttribute('kind'))
RUN(trackElement.kind = 'chapters')
EXPECTED (trackElement.getAttribute('kind') == 'chapters') OK
EXPECTED (trackElement.kind == 'chapters') OK
EXPECTED (trackElement.track.kind == 'chapters') OK
and via attribute
RUN(trackElement.removeAttribute('kind'))
RUN(trackElement.setAttribute('kind', 'chapters'))
EXPECTED (trackElement.kind == 'chapters') OK
EXPECTED (trackElement.track.kind == 'chapters') OK
EXPECTED (trackElement.getAttribute('kind') == 'chapters') OK
++ 'metadata'
set via DOM
RUN(trackElement.removeAttribute('kind'))
RUN(trackElement.kind = 'metadata')
EXPECTED (trackElement.getAttribute('kind') == 'metadata') OK
EXPECTED (trackElement.kind == 'metadata') OK
EXPECTED (trackElement.track.kind == 'metadata') OK
and via attribute
RUN(trackElement.removeAttribute('kind'))
RUN(trackElement.setAttribute('kind', 'metadata'))
EXPECTED (trackElement.kind == 'metadata') OK
EXPECTED (trackElement.track.kind == 'metadata') OK
EXPECTED (trackElement.getAttribute('kind') == 'metadata') OK
END OF TEST