@@ -465,7 +465,12 @@ sealed class MediaItem with _$MediaItem {
|
||||
|
||||
/// Returns hero art candidates in display-preference order.
|
||||
List<String> heroArtCandidates({required double containerAspectRatio}) {
|
||||
final preferred = containerAspectRatio < 1.39 ? [backgroundSquarePath, artPath] : [artPath, backgroundSquarePath];
|
||||
final preferred = switch (kind) {
|
||||
MediaKind.episode when containerAspectRatio < 1.39 => [backgroundSquarePath, grandparentArtPath, artPath],
|
||||
MediaKind.episode => [grandparentArtPath, artPath, backgroundSquarePath],
|
||||
_ when containerAspectRatio < 1.39 => [backgroundSquarePath, artPath],
|
||||
_ => [artPath, backgroundSquarePath],
|
||||
};
|
||||
|
||||
final candidates = <String>[];
|
||||
for (final path in preferred) {
|
||||
|
||||
@@ -100,6 +100,24 @@ void main() {
|
||||
expect(movie.heroArtCandidates(containerAspectRatio: 16 / 9), ['/art', '/square']);
|
||||
expect(movie.heroArt(containerAspectRatio: 16 / 9), '/art');
|
||||
});
|
||||
|
||||
test('episodes prefer show art before episode art for wide hero containers', () {
|
||||
final episode = MediaItem(
|
||||
id: 'e1',
|
||||
backend: MediaBackend.plex,
|
||||
kind: MediaKind.episode,
|
||||
title: 'Episode',
|
||||
grandparentTitle: 'Show',
|
||||
grandparentArtPath: '/show-art',
|
||||
artPath: '/episode-art',
|
||||
backgroundSquarePath: '/square',
|
||||
serverId: 's1',
|
||||
);
|
||||
|
||||
expect(episode.heroArtCandidates(containerAspectRatio: 16 / 9), ['/show-art', '/episode-art', '/square']);
|
||||
expect(episode.heroArt(containerAspectRatio: 16 / 9), '/show-art');
|
||||
expect(episode.heroArtCandidates(containerAspectRatio: 1.0), ['/square', '/show-art', '/episode-art']);
|
||||
});
|
||||
});
|
||||
|
||||
group('MediaItem.isPartiallyWatched', () {
|
||||
|
||||
Reference in New Issue
Block a user