Skip to content

Commit

Permalink
test: Update image filtering tests
Browse files Browse the repository at this point in the history
This better reflects the code landed in PR #3856

Issue #3845

Change-Id: I301f1d70c7c52454c22c6d0ee7c9d1461d7e7691
  • Loading branch information
joeyparrish committed Jan 14, 2022
1 parent 9705639 commit 9c818c4
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions test/util/stream_utils_unit.js
Expand Up @@ -624,24 +624,40 @@ describe('StreamUtils', () => {
stream.mimeType = 'image/png';
});
manifest.addImageStream(3, (stream) => {
stream.mimeType = 'image/jpeg';
stream.mimeType = 'image/jpg';
});
manifest.addImageStream(4, (stream) => {
stream.mimeType = 'image/jpeg';
});
manifest.addImageStream(5, (stream) => {
stream.mimeType = 'image/bogus';
});
manifest.addImageStream(6, (stream) => {
stream.mimeType = 'image/avif';
});
manifest.addImageStream(7, (stream) => {
stream.mimeType = 'image/webp';
});
});

const noVariant = null;
await shaka.util.StreamUtils.filterManifest(
fakeDrmEngine, noVariant, manifest);

// Covers a regression in which we would remove streams with codecs.
// The last two streams should be removed because their full MIME types
// are bogus.
expect(manifest.imageStreams.length).toBe(3);
expect(manifest.imageStreams[0].id).toBe(1);
expect(manifest.imageStreams[1].id).toBe(2);
expect(manifest.imageStreams[2].id).toBe(3);
// The first 4 streams should be there because they are always supported.
// The 5th stream should be removed because the MIME type is bogus.
// The 6th and 7th streams may be there, based on platform support.
expect(manifest.imageStreams).toContain(
jasmine.objectContaining({id: 1}));
expect(manifest.imageStreams).toContain(
jasmine.objectContaining({id: 2}));
expect(manifest.imageStreams).toContain(
jasmine.objectContaining({id: 3}));
expect(manifest.imageStreams).toContain(
jasmine.objectContaining({id: 4}));
expect(manifest.imageStreams).not.toContain(
jasmine.objectContaining({id: 5}));
});

it('filters transport streams', async () => {
Expand Down

0 comments on commit 9c818c4

Please sign in to comment.