Keep chat titles readable in narrow headers
Prioritize the conversation title on narrow chat bars, move compact controls and overflow actions into More, and omit the duplicate title in floating windows. Add focused widget coverage for title sizing, icon dimensions, menus, and floating chrome.
This commit is contained in:
@@ -3,6 +3,8 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
import '../../native_back.dart';
|
||||
import 'package:pipelines_app/core/api_gateway.dart';
|
||||
import 'package:pipelines_app/features/chat/screen.dart';
|
||||
import 'package:pipelines_app/ui/adaptive/segmented_bar.dart'
|
||||
show segmentedMoreKey;
|
||||
|
||||
/// A chat destination gateway: one listed session whose harness offers models.
|
||||
class _ScreenGateway implements ApiGateway {
|
||||
@@ -77,6 +79,22 @@ Future<void> _pumpScreen(
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
|
||||
/// A phone bar keeps the model in the More menu's settings sheet: opens it
|
||||
/// (a wide bar shows the control already).
|
||||
Future<void> _openSettings(WidgetTester tester) async {
|
||||
if (find.byKey(const Key('chat-model')).evaluate().isNotEmpty) return;
|
||||
await tester.tap(find.byKey(segmentedMoreKey).hitTestable());
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.text('Chat settings'));
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
|
||||
/// Dismisses that sheet through its barrier, above the bar.
|
||||
Future<void> _closeSettings(WidgetTester tester) async {
|
||||
await tester.tapAt(const Offset(5, 5));
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
|
||||
void main() {
|
||||
testWidgets('an accepted switch survives leaving and reopening the chat', (
|
||||
tester,
|
||||
@@ -86,6 +104,7 @@ void main() {
|
||||
|
||||
await tester.tap(find.byKey(const Key('chat-row-s')));
|
||||
await tester.pumpAndSettle();
|
||||
await _openSettings(tester);
|
||||
expect(find.byTooltip('Change model (currently model-a)'), findsOneWidget);
|
||||
|
||||
await tester.tap(find.byKey(const Key('chat-model')));
|
||||
@@ -93,6 +112,7 @@ void main() {
|
||||
await tester.tap(find.text('Model Beta'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byTooltip('Change model (currently model-b)'), findsOneWidget);
|
||||
await _closeSettings(tester);
|
||||
|
||||
await tester.tap(findNativeBack());
|
||||
await tester.pumpAndSettle();
|
||||
@@ -102,6 +122,7 @@ void main() {
|
||||
// still show the model the server accepted.
|
||||
await tester.tap(find.byKey(const Key('chat-row-s')));
|
||||
await tester.pumpAndSettle();
|
||||
await _openSettings(tester);
|
||||
|
||||
expect(find.byTooltip('Change model (currently model-b)'), findsOneWidget);
|
||||
expect(find.byTooltip('Change model (currently model-a)'), findsNothing);
|
||||
@@ -133,6 +154,7 @@ void main() {
|
||||
// The deep link opened before any row was tapped: the list's own read
|
||||
// supplies the title and the recorded model, with no second list request.
|
||||
expect(find.text('Wire chat'), findsOneWidget);
|
||||
await _openSettings(tester);
|
||||
expect(find.byTooltip('Change model (currently model-a)'), findsOneWidget);
|
||||
expect(find.byKey(const Key('chat-model')), findsOneWidget);
|
||||
expect(gateway.count('chat_sessions'), 1);
|
||||
|
||||
Reference in New Issue
Block a user