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
+20 -3
View File
@@ -89,11 +89,28 @@ void main() {
of: find.byType(FloatingDestinationBar),
matching: find.byKey(FloatingDestinationBar.rowKey),
);
// Sized to its four tabs at the bottom right.
// Visible captions determine the width while full-size targets stay inset.
final rect = tester.getRect(destinationPill);
expect(rect.width, lessThanOrEqualTo(390 - 2 * 16));
expect(
tester.getSize(destinationPill).width,
FloatingDestinationBar.rowWidth(cupertino: cupertino, tabs: 4),
tester
.widget<FloatingDestinationBar>(find.byType(FloatingDestinationBar))
.showLabels,
isTrue,
);
for (final destination in shellTabDestinations) {
final caption = find.descendant(
of: find.byType(FloatingDestinationBar),
matching: find.text(destinationDetails(destination).label),
);
expect(caption, findsOneWidget);
expect(rect.contains(tester.getRect(caption).center), isTrue);
final target = tester.getSize(
find.byKey(ValueKey('shell.destination.${destination.name}')),
);
expect(target.width, greaterThanOrEqualTo(44));
expect(target.height, greaterThanOrEqualTo(44));
}
expect(tester.getRect(destinationPill).right, 390 - 16);
await tester.tap(find.byKey(const ValueKey('shell.destination.chat')));
await tester.pump();