Neue Melo-UI Phase 1: 4 Tabs (Meine Musik/Suche/Favoriten/Download) + Sortierung
- Meine Musik als Startbildschirm ohne Topbar: Kopfzeile (Einstellungen, Suche, Musikerkennung), Schnellzugriffe, Shuffle + Sortieren, Liederliste - Sortierung nach Zuletzt hinzugefuegt / Name (A-Z-#) / Wie oft abgespielt, auf- und absteigend, pro Liste gespeichert (SortStore) - Favoriten als eigener Tab mit gleicher Shuffle-/Sortier-Leiste - Download-Tab uebernimmt den Navidrome-Server-Browser - DB-Schema 3: playCount, gezaehlt beim Titelstart - Theme auf #0B0B10 / #c0392b - Scan-Aktionen aus der entfallenen Topbar jetzt in den Einstellungen Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011snPXPafPC5i87o68H14W7
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
import 'package:drift/native.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:melo/library/database.dart';
|
||||
import 'package:melo/player/audio_handler.dart';
|
||||
|
||||
void main() {
|
||||
group('shouldCountPlay', () {
|
||||
test('zählt einen neu gestarteten Titel', () {
|
||||
expect(shouldCountPlay(0, null), isTrue);
|
||||
expect(shouldCountPlay(3, 2), isTrue);
|
||||
});
|
||||
|
||||
test('zählt denselben Titel nicht mehrfach', () {
|
||||
expect(shouldCountPlay(2, 2), isFalse);
|
||||
});
|
||||
|
||||
test('zählt nicht ohne aktuellen Titel', () {
|
||||
expect(shouldCountPlay(null, 1), isFalse);
|
||||
});
|
||||
});
|
||||
|
||||
group('MeloDb.incrementPlayCount', () {
|
||||
late MeloDb db;
|
||||
setUp(() => db = MeloDb(NativeDatabase.memory()));
|
||||
tearDown(() => db.close());
|
||||
|
||||
test('erhöht den Zähler des Songs um eins', () async {
|
||||
await db.upsertSongs([
|
||||
SongsCompanion.insert(
|
||||
id: '1',
|
||||
path: '/a.mp3',
|
||||
title: 'Song A',
|
||||
dateAddedMs: 0,
|
||||
updatedAtMs: 0,
|
||||
),
|
||||
]);
|
||||
|
||||
await db.incrementPlayCount('1');
|
||||
await db.incrementPlayCount('1');
|
||||
|
||||
final song = (await db.watchSongs().first).single;
|
||||
expect(song.playCount, 2);
|
||||
});
|
||||
|
||||
test('lässt andere Songs unberührt', () async {
|
||||
await db.upsertSongs([
|
||||
SongsCompanion.insert(
|
||||
id: '1', path: '/a.mp3', title: 'A', dateAddedMs: 0, updatedAtMs: 0),
|
||||
SongsCompanion.insert(
|
||||
id: '2', path: '/b.mp3', title: 'B', dateAddedMs: 0, updatedAtMs: 0),
|
||||
]);
|
||||
|
||||
await db.incrementPlayCount('1');
|
||||
|
||||
final songs = await db.watchSongs().first;
|
||||
expect(songs.firstWhere((s) => s.id == '1').playCount, 1);
|
||||
expect(songs.firstWhere((s) => s.id == '2').playCount, 0);
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user