mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-08-27 05:12:29 +02:00
fix(ui): align metadata and wrap track badges
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:spotiflac_android/l10n/app_localizations.dart';
|
||||
import 'package:spotiflac_android/widgets/audio_quality_badges.dart';
|
||||
import 'package:spotiflac_android/widgets/in_library_badge.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('track metadata badges wrap on a narrow result row', (
|
||||
tester,
|
||||
) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
home: Scaffold(
|
||||
body: Align(
|
||||
child: SizedBox(
|
||||
width: 180,
|
||||
child: Builder(
|
||||
builder: (context) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
return TrackMetadataBadgesLine(
|
||||
primary: const Text(
|
||||
'RADWIMPS',
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
badges: [
|
||||
AudioQualityBadge(
|
||||
label: '16-bit',
|
||||
colorScheme: colorScheme,
|
||||
),
|
||||
DolbyAtmosBadge(colorScheme: colorScheme),
|
||||
const InLibraryBadge(),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(tester.takeException(), isNull);
|
||||
expect(
|
||||
tester.getTopLeft(find.byType(InLibraryBadge)).dy,
|
||||
greaterThan(tester.getTopLeft(find.text('RADWIMPS')).dy),
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -56,5 +56,14 @@ void main() {
|
||||
separators.every((text) => text.style?.color == Colors.white70),
|
||||
isTrue,
|
||||
);
|
||||
|
||||
final durationLabel = find.text('Duration');
|
||||
final metadataRow = find
|
||||
.ancestor(of: durationLabel, matching: find.byType(Row))
|
||||
.first;
|
||||
final row = tester.widget<Row>(metadataRow);
|
||||
|
||||
expect(row.crossAxisAlignment, CrossAxisAlignment.baseline);
|
||||
expect(row.textBaseline, TextBaseline.alphabetic);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user