blob: 83f4007502fb0091d67321c192aa51e6e21f1557 [file] [log] [blame]
Test that directionality is set correctly on cues.
** RTL cues alternate with LTR cues **
EVENT(canplaythrough)
EVENT(seeked)
** Jump to next cue **
EXPECTED (video.currentTime == '0.25') OK
EXPECTED (testTrack.track.activeCues.length == '1') OK
EXPECTED (testTrack.track.activeCues[0].text == 'تجربة') OK
EXPECTED (testCueDisplayBox.innerText == 'تجربة') OK
** The position should be default and CSS direction set to rtl **
EXPECTED (2 * testCueDisplayBox.offsetLeft == video.videoWidth - testCueDisplayBox.offsetWidth == 'true') OK
EXPECTED (getComputedStyle(testCueDisplayBox).direction == 'rtl') OK
RUN(video.currentTime = 0.75)
EVENT(seeked)
** Jump to next cue **
EXPECTED (video.currentTime == '0.75') OK
EXPECTED (testTrack.track.activeCues.length == '1') OK
EXPECTED (testTrack.track.activeCues[0].text == ' 1234') OK
EXPECTED (testCueDisplayBox.innerText == ' 1234') OK
** The position should be default and CSS direction set to ltr **
EXPECTED (2 * testCueDisplayBox.offsetLeft == video.videoWidth - testCueDisplayBox.offsetWidth == 'true') OK
EXPECTED (getComputedStyle(testCueDisplayBox).direction == 'ltr') OK
RUN(video.currentTime = 1.25)
EVENT(seeked)
** Jump to next cue **
EXPECTED (video.currentTime == '1.25') OK
EXPECTED (testTrack.track.activeCues.length == '1') OK
EXPECTED (testTrack.track.activeCues[0].text == 'تجربة LTR new line, but cue should be RTL') OK
EXPECTED (testCueDisplayBox.innerText == 'تجربة LTR new line, but cue should be RTL') OK
** The position should be default and CSS direction set to rtl **
EXPECTED (2 * testCueDisplayBox.offsetLeft == video.videoWidth - testCueDisplayBox.offsetWidth == 'true') OK
EXPECTED (getComputedStyle(testCueDisplayBox).direction == 'rtl') OK
RUN(video.currentTime = 1.75)
EVENT(seeked)
** Jump to next cue **
EXPECTED (video.currentTime == '1.75') OK
EXPECTED (testTrack.track.activeCues.length == '1') OK
EXPECTED (testTrack.track.activeCues[0].text == 'LTR cue تجربة') OK
EXPECTED (testCueDisplayBox.innerText == 'LTR cue تجربة') OK
** The position should be default and CSS direction set to ltr **
EXPECTED (2 * testCueDisplayBox.offsetLeft == video.videoWidth - testCueDisplayBox.offsetWidth == 'true') OK
EXPECTED (getComputedStyle(testCueDisplayBox).direction == 'ltr') OK
RUN(video.currentTime = 2.25)
EVENT(seeked)
** Jump to next cue **
EXPECTED (video.currentTime == '2.25') OK
EXPECTED (testTrack.track.activeCues.length == '1') OK
EXPECTED (testTrack.track.activeCues[0].text == ';1234تجربة') OK
EXPECTED (testCueDisplayBox.innerText == ';1234تجربة') OK
** The position should be default and CSS direction set to rtl **
EXPECTED (2 * testCueDisplayBox.offsetLeft == video.videoWidth - testCueDisplayBox.offsetWidth == 'true') OK
EXPECTED (getComputedStyle(testCueDisplayBox).direction == 'rtl') OK
RUN(video.currentTime = 2.75)
EVENT(seeked)
** Jump to next cue **
EXPECTED (video.currentTime == '2.75') OK
EXPECTED (testTrack.track.activeCues.length == '1') OK
EXPECTED (testTrack.track.activeCues[0].text == ' ०१२३४५६७८९ ') OK
EXPECTED (testCueDisplayBox.innerText == ' ०१२३४५६७८९ ') OK
** The position should be default and CSS direction set to ltr **
EXPECTED (2 * testCueDisplayBox.offsetLeft == video.videoWidth - testCueDisplayBox.offsetWidth == 'true') OK
EXPECTED (getComputedStyle(testCueDisplayBox).direction == 'ltr') OK
END OF TEST