blob: 6175d3002fac3ef102ea57e3d18f24d9f3be341f [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)') OK
EXPECTED (trackMenuItems[3].textContent == 'y (English-Australia)') OK
EXPECTED (trackMenuItems[4].textContent == 'v (English)') OK
EXPECTED (trackMenuItems[5].textContent == 'x (English-Australia)') OK
EXPECTED (trackMenuItems[6].textContent == 'w (Japanese)') OK
EXPECTED (trackMenuItems[7].textContent == 'z (Japanese)') OK
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 'z (日本語)' FAIL
EXPECTED (trackMenuItems[3].textContent == 'v (English)'), OBSERVED 'v (英語)' FAIL
EXPECTED (trackMenuItems[4].textContent == 'x (English-Australia)'), OBSERVED 'x (英語-オーストラリア)' FAIL
EXPECTED (video.textTracks.length == '6') OK
EXPECTED (trackMenuItems.length == '5') OK
END OF TEST