c47deb3c87
HorizontalScrollRow takes an optional shared ScrollController so multi-row sections (Most played: 3 rows) couple their scroll like the web HorizontalScrollRow.svelte. Cards fall back to the synced album-fallback.svg when coverUrl is empty.
50 lines
1.4 KiB
Dart
50 lines
1.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
import 'package:minstrel/library/widgets/album_card.dart';
|
|
import 'package:minstrel/library/widgets/track_row.dart';
|
|
import 'package:minstrel/models/album.dart';
|
|
import 'package:minstrel/models/track.dart';
|
|
import 'package:minstrel/theme/theme_data.dart';
|
|
|
|
void main() {
|
|
testWidgets('AlbumCard renders title and artist', (tester) async {
|
|
await tester.pumpWidget(MaterialApp(
|
|
theme: buildThemeData(),
|
|
home: Scaffold(
|
|
body: AlbumCard(
|
|
album: const AlbumRef(
|
|
id: 'a',
|
|
title: 'Geogaddi',
|
|
artistId: 'x',
|
|
artistName: 'Boards of Canada',
|
|
),
|
|
onTap: () {},
|
|
),
|
|
),
|
|
));
|
|
expect(find.text('Geogaddi'), findsOneWidget);
|
|
expect(find.text('Boards of Canada'), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('TrackRow shows mm:ss duration', (tester) async {
|
|
await tester.pumpWidget(MaterialApp(
|
|
theme: buildThemeData(),
|
|
home: Scaffold(
|
|
body: TrackRow(
|
|
track: const TrackRef(
|
|
id: 't',
|
|
title: 'Roygbiv',
|
|
albumId: 'a',
|
|
artistId: 'x',
|
|
durationSec: 137,
|
|
trackNumber: 4,
|
|
),
|
|
onTap: () {},
|
|
),
|
|
),
|
|
));
|
|
expect(find.text('02:17'), findsOneWidget);
|
|
});
|
|
}
|