mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-08-27 05:12:29 +02:00
feat(metadata): show explicit badges in track titles
This commit is contained in:
@@ -114,6 +114,16 @@ void main() {
|
||||
expect(restored.format, 'flac');
|
||||
});
|
||||
|
||||
test('explicit metadata survives history serialization', () {
|
||||
final item = _historyItem(
|
||||
id: 'explicit',
|
||||
filePath: '/music/Album/Explicit Song.flac',
|
||||
downloadedAt: DateTime.utc(2026, 7, 23),
|
||||
).copyWith(explicit: true);
|
||||
|
||||
expect(DownloadHistoryItem.fromJson(item.toJson()).explicit, isTrue);
|
||||
});
|
||||
|
||||
test('placeholder refresh cannot erase an existing measured quality', () {
|
||||
expect(
|
||||
resolvePersistedHistoryQuality(
|
||||
|
||||
@@ -128,6 +128,7 @@ void main() {
|
||||
scannedAt: DateTime(2026),
|
||||
bitDepth: 24,
|
||||
sampleRate: 96000,
|
||||
explicit: true,
|
||||
);
|
||||
|
||||
final updated = item.withAudioMetadata(bitrate: 1840);
|
||||
@@ -135,6 +136,7 @@ void main() {
|
||||
expect(updated.bitrate, 1840);
|
||||
expect(updated.bitDepth, 24);
|
||||
expect(updated.sampleRate, 96000);
|
||||
expect(updated.explicit, isTrue);
|
||||
expect(updated.trackName, 'Song');
|
||||
expect(updated.filePath, '/music/song.flac');
|
||||
expect(updated.sourceId, 'external-ssd');
|
||||
@@ -142,6 +144,7 @@ void main() {
|
||||
LocalLibraryItem.fromJson(updated.toJson()).sourceId,
|
||||
'external-ssd',
|
||||
);
|
||||
expect(LocalLibraryItem.fromJson(updated.toJson()).explicit, isTrue);
|
||||
});
|
||||
|
||||
test('recognizes a retained external source index', () {
|
||||
|
||||
@@ -11,6 +11,7 @@ void main() {
|
||||
sampleRate: 96000,
|
||||
bitrate: 2860,
|
||||
format: 'flac',
|
||||
explicit: true,
|
||||
);
|
||||
|
||||
test('queue media exposes technical quality to Now Playing immediately', () {
|
||||
@@ -21,6 +22,7 @@ void main() {
|
||||
'sample_rate': 96000,
|
||||
'bitrate': 2860,
|
||||
'format': 'flac',
|
||||
'explicit': true,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -32,6 +34,7 @@ void main() {
|
||||
expect(restored.sampleRate, 96000);
|
||||
expect(restored.bitrate, 2860);
|
||||
expect(restored.format, 'flac');
|
||||
expect(restored.explicit, isTrue);
|
||||
});
|
||||
|
||||
test('file probe cannot erase valid queue quality with empty values', () {
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:spotiflac_android/l10n/l10n.dart';
|
||||
import 'package:spotiflac_android/providers/download_history_provider.dart';
|
||||
import 'package:spotiflac_android/screens/track_metadata_screen.dart';
|
||||
import 'package:spotiflac_android/widgets/album_detail_header.dart';
|
||||
import 'package:spotiflac_android/widgets/audio_quality_badges.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('metadata hero keeps technical text legible in light theme', (
|
||||
@@ -25,6 +26,7 @@ void main() {
|
||||
bitDepth: 16,
|
||||
sampleRate: 44100,
|
||||
format: 'flac',
|
||||
explicit: true,
|
||||
);
|
||||
|
||||
await tester.pumpWidget(
|
||||
@@ -41,6 +43,7 @@ void main() {
|
||||
|
||||
final headerMeta = find.byType(HeaderMetaRow);
|
||||
expect(headerMeta, findsOneWidget);
|
||||
expect(find.byType(ExplicitBadge), findsNWidgets(2));
|
||||
for (final label in const ['16-bit/44.1kHz', '4:10', 'Tidal-web']) {
|
||||
final text = tester.widget<Text>(
|
||||
find.descendant(of: headerMeta, matching: find.text(label)),
|
||||
|
||||
Reference in New Issue
Block a user