Skip to content

Commit

Permalink
Test Video Roles Are Not Included in Audio-Language-Role
Browse files Browse the repository at this point in the history
A change to how we collect the audio-lanugage-role pairs allowed
the video roles to be included.

This change adds a test to make sure that does not happen. It
will fail now and be fixed in a later CL.

Issue #1731

Change-Id: I1178fce70f38ff7b6d9ddabfb73157985f6f63b6
  • Loading branch information
vaage committed Dec 18, 2018
1 parent 8c69ab1 commit 275a68c
Showing 1 changed file with 36 additions and 12 deletions.
48 changes: 36 additions & 12 deletions test/player_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -3343,8 +3343,23 @@ describe('Player', function() {
});
});

describe('get*LanguageAndRoles', function() {
it('returns a list of language/role combinations', async () => {
describe('getAudioLanguagesAndRoles', () => {
it('ignores video roles', async () => {
manifest = new shaka.test.ManifestGenerator()
.addPeriod(0)
.addVariant(0)
.addVideo(1).roles(['video-only-role'])
.addAudio(2).roles(['audio-only-role']).language('en')
.build();

await player.load(fakeManifestUri, 0, parserFactory);

expect(player.getAudioLanguagesAndRoles()).toEqual([
{language: 'en', role: 'audio-only-role'},
]);
});

it('lists all language-role combinations', async () => {
await player.load(fakeManifestUri, 0, parserFactory);
expect(player.getAudioLanguagesAndRoles()).toEqual([
{language: 'fr', role: ''},
Expand All @@ -3353,23 +3368,32 @@ describe('Player', function() {
{language: 'de', role: 'foo'},
{language: 'de', role: 'bar'},
]);
expect(player.getTextLanguagesAndRoles()).toEqual([
{language: 'es', role: 'baz'},
{language: 'es', role: 'qwerty'},
{language: 'en', role: 'main'},
{language: 'en', role: 'caption'},
{language: 'en', role: 'subtitle'},
]);
});

it('returns "und" for video-only tracks', async () => {
manifest = videoOnlyManifest;
it('uses "und" for video-only tracks', async () => {
manifest = new shaka.test.ManifestGenerator()
.addPeriod(0)
.addVariant(0)
.addVideo(1).roles(['video-only-role'])
.build();

await player.load(fakeManifestUri, 0, parserFactory);
expect(player.getAudioLanguagesAndRoles()).toEqual([
{language: 'und', role: ''},
]);
expect(player.getTextLanguagesAndRoles()).toEqual([]);
});
});

describe('getTextLanguageAndRoles', function() {
it('lists all language-role combinations', async () => {
await player.load(fakeManifestUri, 0, parserFactory);
expect(player.getTextLanguagesAndRoles()).toEqual([
{language: 'es', role: 'baz'},
{language: 'es', role: 'qwerty'},
{language: 'en', role: 'main'},
{language: 'en', role: 'caption'},
{language: 'en', role: 'subtitle'},
]);
});
});
});
Expand Down

0 comments on commit 275a68c

Please sign in to comment.