blob: 7c38bf68141c76d592251126458bd09de9fd78f6 [file] [log] [blame]
Test that captions and subtitles are sorted in the menu according to user preferences.
EVENT(canplaythrough)
*** Set the user language preference.
RUN(internals.setUserPreferredLanguages(['en']))
** Test with preferred language set to English, track type set to captions
RUN(internals.settings.setShouldDisplayTrackKind('Captions', true))
EXPECTED (trackMenuItems[0].textContent == 'Off') OK
EXPECTED (trackMenuItems[1].textContent == 'Auto (Recommended)') OK
EXPECTED (trackMenuItems[2].textContent == 'u (English)'), OBSERVED 'u' FAIL
EXPECTED (trackMenuItems[3].textContent == 'y (English-Australia)'), OBSERVED 'v' FAIL
EXPECTED (trackMenuItems[4].textContent == 'v (English)'), OBSERVED 'w' FAIL
EXPECTED (trackMenuItems[5].textContent == 'x (English-Australia)'), OBSERVED 'x' FAIL
EXPECTED (trackMenuItems[6].textContent == 'w (Japanese)'), OBSERVED 'y' FAIL
EXPECTED (trackMenuItems[7].textContent == 'z (Japanese)'), OBSERVED 'z' FAIL
EXPECTED (video.textTracks.length == '6') OK
EXPECTED (trackMenuItems.length == '8') OK
** Change preferred language to Japanese, change preference to subtitles
RUN(internals.setUserPreferredLanguages(['ja']))
RUN(internals.settings.setShouldDisplayTrackKind('Captions', false))
RUN(internals.settings.setShouldDisplayTrackKind('Subtitles', true))
EXPECTED (trackMenuItems[0].textContent == 'Off') OK
EXPECTED (trackMenuItems[1].textContent == 'Auto (Recommended)') OK
EXPECTED (trackMenuItems[2].textContent == 'z (Japanese)'), OBSERVED 'u' FAIL
EXPECTED (trackMenuItems[3].textContent == 'v (English)'), OBSERVED 'v' FAIL
EXPECTED (trackMenuItems[4].textContent == 'x (English-Australia)'), OBSERVED 'w' FAIL
EXPECTED (video.textTracks.length == '6') OK
EXPECTED (trackMenuItems.length == '5'), OBSERVED '8' FAIL
END OF TEST