mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-08-03 01:28:37 +02:00
feat(metadata): add embedded cover resize options
This commit is contained in:
@@ -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,
|
||||
);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user