feat(metadata): add embedded cover resize options

This commit is contained in:
zarzet
2026-08-01 18:24:27 +07:00
parent ed60cafb90
commit d4b617f49a
17 changed files with 441 additions and 34 deletions
+34
View File
@@ -0,0 +1,34 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:spotiflac_android/services/ffmpeg_service.dart';
void main() {
test('cover resize uses safe arguments and preserves aspect ratio', () {
final arguments = FFmpegService.buildCoverResizeArguments(
inputPath: '/tmp/input cover.jpg',
outputPath: '/tmp/output cover.jpg',
maxDimension: 1500,
);
expect(arguments, containsAllInOrder(['-i', '/tmp/input cover.jpg']));
expect(
arguments,
containsAllInOrder([
'-vf',
'scale=1500:1500:force_original_aspect_ratio=decrease:flags=lanczos',
]),
);
expect(arguments, containsAllInOrder(['-frames:v', '1', '-update', '1']));
expect(arguments.last, '/tmp/output cover.jpg');
});
test('cover resize rejects unreasonable dimensions', () {
expect(
() => FFmpegService.buildCoverResizeArguments(
inputPath: 'input.jpg',
outputPath: 'output.jpg',
maxDimension: 0,
),
throwsArgumentError,
);
});
}