Sperrbildschirm und ReplayGain - DB-Schema 6: lyrics + gain_db - Songtext bevorzugt lokalen Tag, Server nur als Rueckfall; Song-ID-Bug beim Lyrics-Aufruf behoben - "Als Naechstes spielen" / "Zur Warteschlange hinzufuegen" ohne Eingriff in Favoriten oder Wiedergabelisten - songToMediaItem nimmt eine Cover-Vorgabe: Sperrbildschirm zeigt das Kategorie-Cover - ReplayGain: Tags werden gelesen, laute Titel abgesenkt, abschaltbar Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011snPXPafPC5i87o68H14W7
57 lines
1.4 KiB
Dart
57 lines
1.4 KiB
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:melo/library/database.dart';
|
|
import 'package:melo/library/song_media.dart';
|
|
|
|
Song _song({String? coverPath}) => Song(
|
|
id: 'song-1',
|
|
path: '/a.mp3',
|
|
title: 'A',
|
|
coverPath: coverPath,
|
|
dateAddedMs: 0,
|
|
updatedAtMs: 0,
|
|
deleted: false,
|
|
playCount: 0,
|
|
categoriesEdited: false,
|
|
);
|
|
|
|
void main() {
|
|
test('songToMediaItem trägt die Song-UUID in extras', () {
|
|
final song = Song(
|
|
id: 'song-1',
|
|
path: '/a.mp3',
|
|
title: 'A',
|
|
artist: null,
|
|
album: null,
|
|
durationMs: null,
|
|
coverPath: null,
|
|
dateAddedMs: 0,
|
|
updatedAtMs: 0,
|
|
deleted: false,
|
|
playCount: 0,
|
|
categoriesEdited: false,
|
|
);
|
|
|
|
final item = songToMediaItem(song);
|
|
|
|
expect(item.extras?['songId'], song.id);
|
|
});
|
|
|
|
test('ohne Cover-Vorgabe gilt das eigene Cover des Songs', () {
|
|
final item = songToMediaItem(_song(coverPath: '/eigen.img'));
|
|
|
|
expect(item.artUri, Uri.file('/eigen.img'));
|
|
});
|
|
|
|
test('Cover-Vorgabe (z. B. aus der Kategorie) gewinnt — auch auf dem '
|
|
'Sperrbildschirm', () {
|
|
final item =
|
|
songToMediaItem(_song(coverPath: '/eigen.img'), cover: '/kategorie.img');
|
|
|
|
expect(item.artUri, Uri.file('/kategorie.img'));
|
|
});
|
|
|
|
test('ohne jedes Cover bleibt artUri leer', () {
|
|
expect(songToMediaItem(_song()).artUri, isNull);
|
|
});
|
|
}
|