Merge commit '2e41717e83132e55d296853c0338bc2c7ed87b9d' into pipelines/run-20261111-1927-unify-chat-selectors-with-permission-men-e1a8

This commit is contained in:
2026-11-11 19:53:26 +00:00
16 changed files with 248 additions and 18 deletions
@@ -16,7 +16,9 @@ import 'package:pipelines_app/shell/windows/window_host.dart';
import 'package:pipelines_app/shell/windows/window_kind.dart';
import 'package:pipelines_app/shell/windows/window_manager.dart';
import 'package:pipelines_app/shell/windows/window_store.dart';
import 'package:pipelines_app/shell/windows/window_entry.dart';
import 'package:pipelines_app/ui/motion/fade_through_stack.dart';
import 'package:pipelines_app/ui/input/keyboard_owner.dart';
import 'conversation/chat_thread_fixtures.dart';
@@ -46,6 +48,19 @@ class _Store implements WindowStore {
}
}
class _TerminalKind extends WindowKind {
@override
String get key => 'terminal';
@override
bool get serverScoped => false;
@override
IconData get icon => Icons.terminal;
@override
String title(BuildContext context, WindowEntry entry) => entry.contentId;
@override
Widget build(BuildContext context, WindowEntry entry) => const SizedBox();
}
Finder _thread(String id) => find.byWidgetPredicate(
(widget) => widget is ChatThreadView && widget.sessionId == id,
skipOffstage: false,
@@ -83,21 +98,21 @@ class _App {
late final ChatRuntime runtime;
late final WindowManager manager;
late final ChatWindows windows;
final terminalFocus = FocusNode(debugLabel: 'test terminal');
final terminalTyped = <LogicalKeyboardKey>[];
Future<void> start(
WidgetTester tester, {
Size size = const Size(1800, 1000),
bool terminalSurface = false,
}) async {
tester.view.physicalSize = size;
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
bindServerIdentity(gateway, 'server-a');
runtime = ChatRuntime(gateway: gateway, serverKey: 'server-a');
manager = WindowManager(
kinds: WindowKinds(),
store: store,
server: 'server-a',
);
final kinds = WindowKinds()..register(_TerminalKind());
manager = WindowManager(kinds: kinds, store: store, server: 'server-a');
windows = ChatWindows(
manager: manager,
runtime: runtime,
@@ -131,6 +146,21 @@ class _App {
],
),
),
if (terminalSurface)
Positioned.fill(
child: TypingSurface(
child: Focus(
focusNode: terminalFocus,
onKeyEvent: (node, event) {
if (event is KeyDownEvent) {
terminalTyped.add(event.logicalKey);
}
return KeyEventResult.handled;
},
child: const SizedBox(),
),
),
),
Positioned.fill(child: WindowHost(manager: manager)),
],
),
@@ -147,6 +177,7 @@ class _App {
manager.dispose();
destination.dispose();
chatBuilt.dispose();
terminalFocus.dispose();
gateway.close();
}
@@ -187,6 +218,13 @@ Future<void> _chord(WidgetTester tester) async {
await tester.pumpAndSettle();
}
Future<void> _controlChord(WidgetTester tester) async {
await tester.sendKeyDownEvent(LogicalKeyboardKey.controlLeft);
await tester.sendKeyEvent(LogicalKeyboardKey.keyY);
await tester.sendKeyUpEvent(LogicalKeyboardKey.controlLeft);
await tester.pumpAndSettle();
}
void main() {
testWidgets('Float and Dock move the live chat with its draft', (
tester,
@@ -391,6 +429,36 @@ void main() {
await app.stop(tester);
});
testWidgets(
'Ctrl+Y from a terminal raises chat and focuses its composer',
(tester) async {
await _saved('a', 'b');
final app = _App(_Store());
await app.start(tester, terminalSurface: true);
await _menu(tester, 'b', 'Float (Option+Y)');
app.manager.open('terminal', 'terminal');
app.terminalFocus.requestFocus();
await tester.pump();
await _controlChord(tester);
final input = _input('b');
expect(_shown('Chat b'), findsOneWidget);
expect(
tester.widget<EditableText>(input).focusNode.hasPrimaryFocus,
isTrue,
);
tester.testTextInput.enterText('from terminal');
await tester.pump();
expect(
tester.widget<EditableText>(input).controller.text,
'from terminal',
);
expect(app.terminalTyped, isEmpty);
await app.stop(tester);
},
variant: const TargetPlatformVariant({TargetPlatform.macOS}),
);
testWidgets('floating chats saved by an older build come back as windows', (
tester,
) async {
@@ -93,6 +93,31 @@ void main() {
expect(find.widgetWithText(TextButton, 'demo'), findsOneWidget);
});
testWidgets('file sorting uses a sort icon and preserves direction', (
tester,
) async {
final controller = await pump(tester);
expect(find.byTooltip('Sort'), findsOneWidget);
expect(find.byIcon(Icons.sort), findsOneWidget);
expect(controller.sort.key, FilesSortKey.name);
expect(controller.sort.ascending, isTrue);
await tester.tap(find.byTooltip('Sort'));
await tester.pumpAndSettle();
await tester.tap(find.text('size'));
await tester.pumpAndSettle();
expect(controller.sort.key, FilesSortKey.size);
expect(controller.sort.ascending, isTrue);
await tester.tap(find.byTooltip('Sort'));
await tester.pumpAndSettle();
await tester.tap(find.text('size ↑'));
await tester.pumpAndSettle();
expect(controller.sort.key, FilesSortKey.size);
expect(controller.sort.ascending, isFalse);
});
testWidgets('text tap opens shared viewer and fetches inline URL', (
tester,
) async {
@@ -232,7 +232,7 @@ void main() {
});
testWidgets(
'on macOS Ctrl+Y in a terminal stays with it; Cmd+Y and Option+Y toggle',
'on macOS Ctrl+Y from a terminal raises chat; Cmd+Y and Option+Y toggle',
(tester) async {
await wide(tester);
final typing = FocusNode();
@@ -256,12 +256,12 @@ void main() {
typing.requestFocus();
await tester.pump();
await _chord(tester, LogicalKeyboardKey.controlLeft);
expect(h.manager.groupShown(chatWindowKind), isTrue);
expect(typed, contains(LogicalKeyboardKey.keyY));
await _chord(tester, LogicalKeyboardKey.metaLeft);
expect(h.manager.groupShown(chatWindowKind), isFalse);
await _chord(tester);
expect(typed, isNot(contains(LogicalKeyboardKey.keyY)));
await _chord(tester, LogicalKeyboardKey.metaLeft);
expect(h.manager.groupShown(chatWindowKind), isTrue);
await _chord(tester);
expect(h.manager.groupShown(chatWindowKind), isFalse);
},
variant: const TargetPlatformVariant({TargetPlatform.macOS}),
);
@@ -29,6 +29,10 @@ void main() {
chord({LogicalKeyboardKey.controlLeft}, TargetPlatform.linux),
isTrue,
);
expect(
chord({LogicalKeyboardKey.controlLeft}, TargetPlatform.macOS),
isTrue,
);
expect(chord({LogicalKeyboardKey.metaLeft}, TargetPlatform.linux), isFalse);
expect(chord({LogicalKeyboardKey.metaLeft}, TargetPlatform.macOS), isTrue);
expect(