Leave unrelated chat files as main formats them

This commit is contained in:
2026-11-10 15:26:54 +00:00
parent cdd54c113c
commit e059e58caf
8 changed files with 59 additions and 63 deletions
@@ -202,7 +202,7 @@ class _ChatBackgroundTasksState extends State<ChatBackgroundTasks> {
// Level with the field's single line, beside Send.
padding: const EdgeInsetsDirectional.only(end: 4, bottom: 4),
child: Semantics(
identifier: 'chat-background-tasks-button',
identifier: 'chat-background-tasks-button',
button: true,
excludeSemantics: true,
onTap: _open,
@@ -142,10 +142,8 @@ class ChatWorkspaceGeometry {
};
if (gap < -slack || gap > chatPaneDividerExtent + slack) continue;
final overlap = horizontal
? math.min(origin.bottom, rect.bottom) -
math.max(origin.top, rect.top)
: math.min(origin.right, rect.right) -
math.max(origin.left, rect.left);
? math.min(origin.bottom, rect.bottom) - math.max(origin.top, rect.top)
: math.min(origin.right, rect.right) - math.max(origin.left, rect.left);
if (overlap <= slack) continue;
final centred = horizontal
? rect.top <= centre && centre < rect.bottom
@@ -82,10 +82,7 @@ Future<void> _openMenu(WidgetTester tester, String session) async {
MenuItemButton _item(WidgetTester tester, String label) =>
tester.widget<MenuItemButton>(
find.ancestor(
of: find.text(label),
matching: find.byType(MenuItemButton),
),
find.ancestor(of: find.text(label), matching: find.byType(MenuItemButton)),
);
ChatWorkspaceController _controller(WidgetTester tester) =>
@@ -208,9 +205,7 @@ void main() {
final gateway = _Gateway()..history = (_) async => chatPage([]);
addTearDown(gateway.close);
await tester.pumpWidget(
MaterialApp(
home: Scaffold(body: ChatScreen(gateway: gateway)),
),
MaterialApp(home: Scaffold(body: ChatScreen(gateway: gateway))),
);
await tester.pumpAndSettle();
await tester.tap(find.text('Chat a').first);
@@ -244,6 +244,9 @@ void main() {
isSameColorAs(tint.foreground),
);
// Outside the bar the theme's tint is untouched.
expect(CupertinoTheme.of(context).primaryColor, isNot(tint.foreground));
expect(
CupertinoTheme.of(context).primaryColor,
isNot(tint.foreground),
);
});
}
@@ -271,20 +271,19 @@ void main() {
expect(mounted.gateway.listings, 2);
});
testWidgets(
'A refused move is shown in the server\'s words until dismissed',
(tester) async {
final mounted = await pump(tester);
const refusal = '$shown/docs/notes.txt already exists';
mounted.gateway.refusals['move_path'] = refusal;
await dragOnto(tester, 'notes.txt', 'docs');
expect(find.text(refusal), findsOneWidget);
expect(mounted.gateway.listings, 2, reason: 'reloaded all the same');
await tester.tap(find.text('Dismiss'));
await tester.pumpAndSettle();
expect(find.text(refusal), findsNothing);
},
);
testWidgets('A refused move is shown in the server\'s words until dismissed', (
tester,
) async {
final mounted = await pump(tester);
const refusal = '$shown/docs/notes.txt already exists';
mounted.gateway.refusals['move_path'] = refusal;
await dragOnto(tester, 'notes.txt', 'docs');
expect(find.text(refusal), findsOneWidget);
expect(mounted.gateway.listings, 2, reason: 'reloaded all the same');
await tester.tap(find.text('Dismiss'));
await tester.pumpAndSettle();
expect(find.text(refusal), findsNothing);
});
test('canDropEntryOn refuses files, itself and its own subtree', () {
const docs = DirectoryEntry(
@@ -39,10 +39,11 @@ void main() {
});
test('only visible assistant reply text is unread', () {
bool attention(Map<String, Object?> event) => chatSessionFrameEffect({
'type': 'chat_event',
'chat_event': {'session_id': 's', ...event},
})!.attention;
bool attention(Map<String, Object?> event) =>
chatSessionFrameEffect({
'type': 'chat_event',
'chat_event': {'session_id': 's', ...event},
})!.attention;
for (final status in ['running', 'completed', 'error']) {
expect(
attention({
@@ -66,7 +67,11 @@ void main() {
expect(attention({'kind': 'text', 'delta': ' \n'}), isFalse);
for (final messageKind in ['notice', 'agent_report']) {
expect(
attention({'kind': 'text', 'delta': 'x', 'message_kind': messageKind}),
attention({
'kind': 'text',
'delta': 'x',
'message_kind': messageKind,
}),
isFalse,
);
}
@@ -76,36 +76,34 @@ void main() {
expect(_opacity(tester), 1);
});
testWidgets(
'desktop shows it on hover and focus, and keeps semantics',
(tester) async {
final semantics = tester.ensureSemantics();
await tester.pumpWidget(_host(48));
expect(_opacity(tester), 0);
// Hidden, it is still reachable by a screen reader.
expect(
tester.getSemantics(_copy),
isSemantics(tooltip: 'Copy', isButton: true, isFocusable: true),
);
testWidgets('desktop shows it on hover and focus, and keeps semantics', (
tester,
) async {
final semantics = tester.ensureSemantics();
await tester.pumpWidget(_host(48));
expect(_opacity(tester), 0);
// Hidden, it is still reachable by a screen reader.
expect(
tester.getSemantics(_copy),
isSemantics(tooltip: 'Copy', isButton: true, isFocusable: true),
);
final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
addTearDown(mouse.removePointer);
await mouse.addPointer(location: Offset.zero);
await mouse.moveTo(tester.getCenter(find.text('The answer text')));
await tester.pumpAndSettle();
expect(_opacity(tester), 1);
await mouse.moveTo(const Offset(5, 590));
await tester.pumpAndSettle();
expect(_opacity(tester), 0);
final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
addTearDown(mouse.removePointer);
await mouse.addPointer(location: Offset.zero);
await mouse.moveTo(tester.getCenter(find.text('The answer text')));
await tester.pumpAndSettle();
expect(_opacity(tester), 1);
await mouse.moveTo(const Offset(5, 590));
await tester.pumpAndSettle();
expect(_opacity(tester), 0);
// Keyboard focus reveals it too.
await tester.sendKeyEvent(LogicalKeyboardKey.tab);
await tester.pumpAndSettle();
expect(_opacity(tester), 1);
semantics.dispose();
},
variant: TargetPlatformVariant.only(TargetPlatform.macOS),
);
// Keyboard focus reveals it too.
await tester.sendKeyEvent(LogicalKeyboardKey.tab);
await tester.pumpAndSettle();
expect(_opacity(tester), 1);
semantics.dispose();
}, variant: TargetPlatformVariant.only(TargetPlatform.macOS));
for (final (width, inGutter) in [(1400.0, true), (560.0, false)]) {
testWidgets('a ${width.toInt()} px conversation puts Copy '
@@ -125,9 +125,7 @@ void main() {
addTearDown(controller.dispose);
final outer = controller.root as ChatWorkspaceSplit;
controller.resize(outer.id, .3);
final ids = {
for (final s in ['a', 'b', 'c', 'd']) s: _id(controller, s),
};
final ids = {for (final s in ['a', 'b', 'c', 'd']) s: _id(controller, s)};
final serial = controller.moveSerial;
controller.swap(ids['a']!, ids['c']!);
expect(controller.panes.map((p) => p.sessionId), ['c', 'b', 'a', 'd']);