mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-09-02 16:20:57 +02:00
fix(download): preserve finalization metadata and library labels
This commit is contained in:
@@ -1305,6 +1305,14 @@ void main() {
|
||||
);
|
||||
});
|
||||
|
||||
test('treats generic M4A container reports as inconclusive codecs', () {
|
||||
expect(isInconclusiveAudioCodec(null), isTrue);
|
||||
expect(isInconclusiveAudioCodec('m4a'), isTrue);
|
||||
expect(isInconclusiveAudioCodec('MP4'), isTrue);
|
||||
expect(isInconclusiveAudioCodec('flac'), isFalse);
|
||||
expect(isInconclusiveAudioCodec('aac'), isFalse);
|
||||
});
|
||||
|
||||
test('uses m4a for ISO-BMFF audio except AC-4 passthrough', () {
|
||||
expect(isoBmffAudioExtensionForCodec('opus'), '.m4a');
|
||||
expect(isoBmffAudioExtensionForCodec('ec-3'), '.m4a');
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'dart:io';
|
||||
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'package:spotiflac_android/models/settings.dart';
|
||||
import 'package:spotiflac_android/screens/queue_library_refresh_policy.dart';
|
||||
import 'package:spotiflac_android/services/library_database.dart';
|
||||
|
||||
@@ -108,6 +109,82 @@ void main() {
|
||||
);
|
||||
});
|
||||
|
||||
test(
|
||||
'completion bridge survives partial album cancellation until landing',
|
||||
() {
|
||||
expect(
|
||||
shouldRetainCompletionBridge(
|
||||
isRequeued: false,
|
||||
hasActiveDownloads: false,
|
||||
libraryRowLanded: false,
|
||||
hasHistoryItem: true,
|
||||
expired: true,
|
||||
),
|
||||
isTrue,
|
||||
);
|
||||
expect(
|
||||
shouldRetainCompletionBridge(
|
||||
isRequeued: false,
|
||||
hasActiveDownloads: false,
|
||||
libraryRowLanded: true,
|
||||
hasHistoryItem: true,
|
||||
expired: true,
|
||||
),
|
||||
isFalse,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
test('unpersisted completion bridge retains only its short grace period', () {
|
||||
expect(
|
||||
shouldRetainCompletionBridge(
|
||||
isRequeued: false,
|
||||
hasActiveDownloads: false,
|
||||
libraryRowLanded: false,
|
||||
hasHistoryItem: false,
|
||||
expired: false,
|
||||
),
|
||||
isTrue,
|
||||
);
|
||||
expect(
|
||||
shouldRetainCompletionBridge(
|
||||
isRequeued: false,
|
||||
hasActiveDownloads: false,
|
||||
libraryRowLanded: false,
|
||||
hasHistoryItem: false,
|
||||
expired: true,
|
||||
),
|
||||
isFalse,
|
||||
);
|
||||
});
|
||||
|
||||
test('completion bridge fallback follows the current label mode', () {
|
||||
expect(
|
||||
buildCompletionBridgeFallbackQualityLabel(
|
||||
mode: AppSettings.libraryQualityLabelFileFormat,
|
||||
completedItemFilePath: '/music/completed.flac',
|
||||
storedQuality: '24-bit/96kHz',
|
||||
),
|
||||
'FLAC',
|
||||
);
|
||||
expect(
|
||||
buildCompletionBridgeFallbackQualityLabel(
|
||||
mode: AppSettings.libraryQualityLabelBitDepthOnly,
|
||||
completedItemFilePath: '/music/completed.flac',
|
||||
storedQuality: '24-bit/96kHz',
|
||||
),
|
||||
'24-bit',
|
||||
);
|
||||
expect(
|
||||
buildCompletionBridgeFallbackQualityLabel(
|
||||
mode: AppSettings.libraryQualityLabelBitrate,
|
||||
completedItemFilePath: '/music/completed.flac',
|
||||
storedQuality: '24-bit/96kHz',
|
||||
),
|
||||
isNull,
|
||||
);
|
||||
});
|
||||
|
||||
test(
|
||||
'completion probe falls back from stale history to completed path',
|
||||
() async {
|
||||
|
||||
Reference in New Issue
Block a user