fix(cover): preserve provider high-resolution artwork

This commit is contained in:
zarzet
2026-09-04 19:48:15 +07:00
parent 448a3426a0
commit 514081fc6a
2 changed files with 40 additions and 6 deletions
+31
View File
@@ -0,0 +1,31 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:spotiflac_android/utils/cover_art_utils.dart';
void main() {
group('highResCoverUrl', () {
test('upgrades a small Deezer cover to display quality', () {
expect(
highResCoverUrl(
'https://cdn-images.dzcdn.net/images/cover/hash/'
'250x250-000000-80-0-0.jpg',
),
'https://cdn-images.dzcdn.net/images/cover/hash/'
'1000x1000-000000-80-0-0.jpg',
);
});
test('does not downgrade provider-supplied Deezer artwork', () {
const url =
'https://cdn-images.dzcdn.net/images/cover/hash/'
'1400x1400-000000-80-0-0.jpg';
expect(highResCoverUrl(url), url);
});
test('still upgrades a Spotify 300px cover to 640px', () {
expect(
highResCoverUrl('https://i.scdn.co/image/ab67616d00001e02abcdef'),
'https://i.scdn.co/image/ab67616d0000b273abcdef',
);
});
});
}