Merge branch 'worktree-agent-ae3af4174afca7f4d'
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,7 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/features/chat/conversation/chat_composer_bar.dart';
|
||||
import 'package:pipelines_app/features/chat/conversation/chat_composer_controller.dart';
|
||||
import 'package:pipelines_app/features/chat/conversation/chat_draft_store.dart';
|
||||
import 'package:pipelines_app/features/chat/domain/chat_clipboard_paste_native.dart';
|
||||
|
||||
import '../../../core/keyboard/browser_keys.dart';
|
||||
import 'chat_composer_bar_fixtures.dart';
|
||||
@@ -32,6 +33,12 @@ void main() {
|
||||
if (call.method == 'Clipboard.hasStrings') return {'value': true};
|
||||
return null;
|
||||
});
|
||||
// The Linux Runner's clipboard reader: no files, so the text is pasted.
|
||||
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
|
||||
.setMockMethodCallHandler(
|
||||
chatClipboardFilesChannel,
|
||||
(call) async => {'files': const [], 'errors': const []},
|
||||
);
|
||||
});
|
||||
|
||||
tearDown(() {
|
||||
@@ -39,6 +46,8 @@ void main() {
|
||||
gateway.close();
|
||||
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
|
||||
.setMockMethodCallHandler(SystemChannels.platform, null);
|
||||
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
|
||||
.setMockMethodCallHandler(chatClipboardFilesChannel, null);
|
||||
});
|
||||
|
||||
for (final merged in [false, true]) {
|
||||
|
||||
@@ -10,6 +10,7 @@ import 'package:pipelines_app/features/chat/domain/chat_clipboard_paste_native.d
|
||||
import '../conversation/chat_composer_bar_fixtures.dart';
|
||||
|
||||
final _macOS = TargetPlatformVariant.only(TargetPlatform.macOS);
|
||||
final _linux = TargetPlatformVariant.only(TargetPlatform.linux);
|
||||
|
||||
Finder get _field => find.byKey(const Key('chat-composer-field'));
|
||||
|
||||
@@ -77,10 +78,10 @@ void main() {
|
||||
|
||||
Future<void> done(WidgetTester tester) => tester.pumpWidget(const SizedBox());
|
||||
|
||||
test('only the macOS host reads clipboard files natively', () {
|
||||
test('the macOS and Linux hosts read clipboard files natively', () {
|
||||
expect(chatHostReadsClipboardFiles(TargetPlatform.macOS), isTrue);
|
||||
expect(chatHostReadsClipboardFiles(TargetPlatform.linux), isTrue);
|
||||
for (final platform in [
|
||||
TargetPlatform.linux,
|
||||
TargetPlatform.windows,
|
||||
TargetPlatform.android,
|
||||
TargetPlatform.iOS,
|
||||
@@ -228,4 +229,47 @@ void main() {
|
||||
expect(composer.draft, isEmpty);
|
||||
await done(tester);
|
||||
}, variant: _macOS);
|
||||
|
||||
testWidgets('Ctrl+V attaches a copied screenshot on Linux', (tester) async {
|
||||
pasteboard = {
|
||||
'files': [
|
||||
{
|
||||
'name': '',
|
||||
'mime': 'image/png',
|
||||
'bytes': Uint8List.fromList([3]),
|
||||
},
|
||||
],
|
||||
'errors': const [],
|
||||
};
|
||||
expect(hostChatClipboardPaste.isSupported, isTrue);
|
||||
await mount(tester);
|
||||
await tester.showKeyboard(_field);
|
||||
await tester.pump();
|
||||
await paste(tester, modifier: LogicalKeyboardKey.controlLeft);
|
||||
|
||||
expect(fileReads, 1);
|
||||
expect(find.text('pasted-1.png'), findsOneWidget);
|
||||
expect(textReads, 0);
|
||||
await done(tester);
|
||||
}, variant: _linux);
|
||||
|
||||
testWidgets('Ctrl+V of plain text on Linux pastes it once', (tester) async {
|
||||
await mount(tester);
|
||||
await tester.showKeyboard(_field);
|
||||
await paste(tester, modifier: LogicalKeyboardKey.controlLeft);
|
||||
|
||||
expect(fileReads, 1);
|
||||
expect(composer.draft, 'copied text');
|
||||
await done(tester);
|
||||
}, variant: _linux);
|
||||
|
||||
testWidgets('the Super key is not the Linux paste shortcut', (tester) async {
|
||||
await mount(tester);
|
||||
FocusManager.instance.primaryFocus?.unfocus();
|
||||
await tester.pump();
|
||||
await paste(tester);
|
||||
|
||||
expect(fileReads, 0);
|
||||
await done(tester);
|
||||
}, variant: _linux);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user