Verify labeled navigation bounds and scalable targets

This commit is contained in:
2026-11-07 20:50:35 +00:00
parent cb0942b5ee
commit 03ac760361
3 changed files with 111 additions and 24 deletions
+39 -5
View File
@@ -135,8 +135,17 @@ void main() {
expect(pill.overlaps(body), isFalse, reason: 'never over the detail');
expect(
pill.width,
FloatingDestinationBar.rowWidth(cupertino: cupertino, tabs: 4),
lessThanOrEqualTo(list.width - 2 * kFloatingBarMargin),
);
for (final destination in shellTabDestinations) {
final caption = find.byKey(
ValueKey(
'destination-label-${destinationDetails(destination).label}',
),
);
expect(caption, findsOneWidget);
expect(pill.contains(tester.getRect(caption).center), isTrue);
}
// The composer reaches the detail's bottom edge: nothing is reserved
// there for the shell's bar any more.
@@ -183,6 +192,24 @@ void main() {
expect(tabs.bottom, closeTo(800 - kFloatingBarMargin, 0.5));
expect(tabs.left, greaterThan(body.left));
expect(tabs.overlaps(pill), isFalse);
// Page tabs retain their dense icon-only presentation; only app
// destinations gain visible captions.
final detailBar = tester.widget<FloatingDestinationBar>(
find.descendant(
of: find.byKey(const Key('detail-tabs')),
matching: find.byType(FloatingDestinationBar),
),
);
expect(detailBar.showLabels, isFalse);
for (final label in ['One', 'Two', 'Three']) {
expect(
find.descendant(
of: find.byKey(const Key('detail-tabs')),
matching: find.text(label),
),
findsNothing,
);
}
expect(pill.right, lessThan(body.left));
// The item's list pads its end clear of its own tabs.
@@ -246,10 +273,17 @@ void main() {
await tester.pumpWidget(shell(cupertino: cupertino, split: false));
await tester.pump();
final pill = destinationPill(tester);
expect(
pill.width,
FloatingDestinationBar.rowWidth(cupertino: cupertino, tabs: 4),
);
expect(pill.width, lessThanOrEqualTo(390 - 2 * kFloatingBarMargin));
for (final destination in shellTabDestinations) {
expect(
find.byKey(
ValueKey(
'destination-label-${destinationDetails(destination).label}',
),
),
findsOneWidget,
);
}
expect(pill.right, closeTo(390 - kFloatingBarMargin, 0.5));
});