Terminal round 2: tests for every feature; split find host and tab events
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,102 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/features/chat/shell/chat_shell_run.dart';
|
||||
import 'package:pipelines_app/features/chat/shell/chat_shell_terminal_bell.dart';
|
||||
import 'package:pipelines_app/features/chat/shell/chat_shell_terminal_events.dart';
|
||||
|
||||
import 'terminal_view_harness.dart';
|
||||
|
||||
const _flash = ValueKey('terminal-bell-flash');
|
||||
|
||||
String _osc52(String text) =>
|
||||
'\x1b]52;c;${base64.encode(utf8.encode(text))}\x07';
|
||||
|
||||
void main() {
|
||||
testWidgets('a bell flashes the border briefly; the setting turns it off', (
|
||||
tester,
|
||||
) async {
|
||||
final harness = TerminalViewHarness();
|
||||
await harness.pump(tester);
|
||||
expect(find.byKey(_flash), findsNothing);
|
||||
await harness.write(tester, '\x07');
|
||||
expect(find.byKey(_flash), findsOneWidget);
|
||||
await tester.pump(chatShellBellFlash + const Duration(milliseconds: 16));
|
||||
expect(find.byKey(_flash), findsNothing);
|
||||
harness.layout.setBell(false);
|
||||
await tester.pump();
|
||||
await harness.write(tester, '\x07');
|
||||
expect(find.byKey(_flash), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('under reduced motion the bell border holds, then goes', (
|
||||
tester,
|
||||
) async {
|
||||
final harness = TerminalViewHarness();
|
||||
await harness.pump(tester, reduceMotion: true);
|
||||
await harness.write(tester, '\x07');
|
||||
final border =
|
||||
tester.widget<DecoratedBox>(find.byKey(_flash)).decoration
|
||||
as BoxDecoration;
|
||||
expect((border.border! as Border).top.color.a, 1);
|
||||
await tester.pump(chatShellBellFlash + const Duration(milliseconds: 16));
|
||||
expect(find.byKey(_flash), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('OSC 52 from live output sets the clipboard and says so', (
|
||||
tester,
|
||||
) async {
|
||||
final copied = mockClipboard(tester);
|
||||
final harness = TerminalViewHarness();
|
||||
await harness.pump(tester);
|
||||
await harness.write(tester, _osc52('from vim'));
|
||||
expect(copied, ['from vim']);
|
||||
await tester.pump();
|
||||
expect(find.text('Copied from terminal'), findsOneWidget);
|
||||
await tester.pump(const Duration(seconds: 3));
|
||||
await tester.pumpAndSettle();
|
||||
// A read request (?) is ignored.
|
||||
await harness.write(tester, '\x1b]52;c;?\x07');
|
||||
expect(copied, ['from vim']);
|
||||
});
|
||||
|
||||
testWidgets('old output drawn again (a replay) neither copies nor rings', (
|
||||
tester,
|
||||
) async {
|
||||
final copied = mockClipboard(tester);
|
||||
final harness = TerminalViewHarness();
|
||||
await harness.pump(tester);
|
||||
final output = 'old ${_osc52('stale')}\x07done';
|
||||
harness.session.replay(
|
||||
ChatShellRun.fromJson({
|
||||
'id': 'run_1',
|
||||
'command': 'sh',
|
||||
'directory': '/w',
|
||||
'status': 'running',
|
||||
'started_at': 1,
|
||||
'output': output,
|
||||
'output_bytes': utf8.encode(output).length,
|
||||
'terminal': true,
|
||||
})!,
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
expect(copied, isEmpty);
|
||||
expect(harness.session.events.bells.value, 0);
|
||||
expect(find.byKey(_flash), findsNothing);
|
||||
});
|
||||
|
||||
test('OSC 7 reports the folder as a path', () {
|
||||
expect(
|
||||
chatShellWorkingDirectoryPath('file://mac.local/Users/op/src%20x'),
|
||||
'/Users/op/src x',
|
||||
);
|
||||
expect(chatShellWorkingDirectoryPath('file:///tmp'), '/tmp');
|
||||
expect(chatShellWorkingDirectoryPath('https://example.com/a'), isNull);
|
||||
expect(chatShellWorkingDirectoryPath('file://host'), '/');
|
||||
final harness = TerminalViewHarness();
|
||||
addTearDown(harness.session.dispose);
|
||||
harness.terminal.write('\x1b]7;file://mac/Users/op/work\x1b\\');
|
||||
expect(harness.session.events.workingDirectory.value, '/Users/op/work');
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/features/chat/shell/chat_shell_terminal_cursor_blink.dart';
|
||||
import 'package:pipelines_app/features/chat/shell/chat_shell_terminal_links.dart';
|
||||
import 'package:xterm/xterm.dart';
|
||||
|
||||
import 'terminal_view_harness.dart';
|
||||
|
||||
const _phase = chatShellCursorBlinkPhase;
|
||||
|
||||
void main() {
|
||||
bool shown(WidgetTester tester, TerminalViewHarness harness) =>
|
||||
harness.view(tester).cursorBlinkVisible!.value;
|
||||
|
||||
testWidgets('a blinking DECSCUSR cursor blinks while focused and is steady '
|
||||
'once unfocused, leaving no frames scheduled', (tester) async {
|
||||
final harness = TerminalViewHarness();
|
||||
await harness.pump(tester);
|
||||
await harness.write(tester, '\x1b[5 q');
|
||||
await harness.focus(tester);
|
||||
expect(shown(tester, harness), isTrue);
|
||||
await tester.pump(_phase + const Duration(milliseconds: 10));
|
||||
expect(shown(tester, harness), isFalse);
|
||||
await tester.pump(_phase);
|
||||
expect(shown(tester, harness), isTrue);
|
||||
// Output shows it again and restarts the phase.
|
||||
await tester.pump(_phase);
|
||||
expect(shown(tester, harness), isFalse);
|
||||
await harness.write(tester, 'x');
|
||||
expect(shown(tester, harness), isTrue);
|
||||
// Unfocused: steady, and the ticker stopped.
|
||||
harness.view(tester).focusNode!.unfocus();
|
||||
await tester.pump();
|
||||
expect(shown(tester, harness), isTrue);
|
||||
expect(tester.binding.hasScheduledFrame, isFalse);
|
||||
});
|
||||
|
||||
testWidgets('a steady shape (even Ps) does not blink', (tester) async {
|
||||
final harness = TerminalViewHarness();
|
||||
await harness.pump(tester);
|
||||
await harness.write(tester, '\x1b[2 q');
|
||||
await harness.focus(tester);
|
||||
await tester.pump(_phase * 3);
|
||||
expect(shown(tester, harness), isTrue);
|
||||
expect(tester.binding.hasScheduledFrame, isFalse);
|
||||
});
|
||||
|
||||
testWidgets('reduced motion keeps a blinking cursor steady', (tester) async {
|
||||
final harness = TerminalViewHarness();
|
||||
await harness.pump(tester, reduceMotion: true);
|
||||
await harness.write(tester, '\x1b[1 q');
|
||||
await harness.focus(tester);
|
||||
await tester.pump(_phase + const Duration(milliseconds: 10));
|
||||
expect(shown(tester, harness), isTrue);
|
||||
expect(tester.binding.hasScheduledFrame, isFalse);
|
||||
});
|
||||
|
||||
testWidgets('a selection clears when its rows are rewritten, the screen is '
|
||||
'cleared or the program switches screens', (tester) async {
|
||||
final harness = TerminalViewHarness();
|
||||
await harness.pump(tester);
|
||||
await harness.write(tester, 'keep this\r\nother\r\n');
|
||||
final controller = harness.controller(tester);
|
||||
final buffer = harness.terminal.buffer;
|
||||
void select() => controller.setSelection(
|
||||
buffer.createAnchor(0, 0),
|
||||
buffer.createAnchor(4, 0),
|
||||
);
|
||||
select();
|
||||
// Output elsewhere leaves it.
|
||||
await harness.write(tester, 'more output\r\n');
|
||||
expect(controller.selection, isNotNull);
|
||||
// Rewriting the selected row clears it.
|
||||
await harness.write(tester, '\x1b[1;1Hgone');
|
||||
expect(controller.selection, isNull);
|
||||
select();
|
||||
await harness.write(tester, '\x1b[2J');
|
||||
expect(controller.selection, isNull);
|
||||
select();
|
||||
await harness.write(tester, '\x1b[?1049h');
|
||||
expect(controller.selection, isNull);
|
||||
});
|
||||
|
||||
testWidgets('hovering a web or OSC 8 link shows a pointer and underlines '
|
||||
'it; a click opens it as before', (tester) async {
|
||||
final harness = TerminalViewHarness();
|
||||
await harness.pump(tester);
|
||||
await harness.write(
|
||||
tester,
|
||||
'see https://example.com/a now\r\n'
|
||||
'\x1b]8;;https://example.org/b\x1b\\docs\x1b]8;;\x1b\\ plain',
|
||||
);
|
||||
final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
|
||||
addTearDown(mouse.removePointer);
|
||||
await mouse.addPointer(location: harness.cellCentre(tester, 0, 0));
|
||||
await tester.pump();
|
||||
expect(harness.view(tester).mouseCursor, SystemMouseCursors.text);
|
||||
await mouse.moveTo(harness.cellCentre(tester, 8, 0));
|
||||
await tester.pump();
|
||||
expect(harness.view(tester).mouseCursor, SystemMouseCursors.click);
|
||||
// The OSC 8 link's text is not an address; its target is.
|
||||
await mouse.moveTo(harness.cellCentre(tester, 1, 1));
|
||||
await tester.pump();
|
||||
expect(harness.view(tester).mouseCursor, SystemMouseCursors.click);
|
||||
await mouse.moveTo(harness.cellCentre(tester, 7, 1));
|
||||
await tester.pump();
|
||||
expect(harness.view(tester).mouseCursor, SystemMouseCursors.text);
|
||||
});
|
||||
|
||||
test('the link under a cell: OSC 8 first, then printed addresses', () {
|
||||
final terminal = Terminal(maxLines: 50)..resize(20, 4);
|
||||
terminal.write(
|
||||
'\x1b]8;;https://example.org/long\x1b\\0123456789abcdefghijkl'
|
||||
'\x1b]8;;\x1b\\ x https://e.com/q).',
|
||||
);
|
||||
final hyperlink = chatShellTerminalLinkAt(terminal, const CellOffset(5, 0));
|
||||
expect(hyperlink!.uri.toString(), 'https://example.org/long');
|
||||
// It wraps onto the next row.
|
||||
expect(hyperlink.begin, const CellOffset(0, 0));
|
||||
expect(hyperlink.end, const CellOffset(2, 1));
|
||||
final printed = chatShellTerminalLinkAt(terminal, const CellOffset(6, 1));
|
||||
expect(printed!.uri.toString(), 'https://e.com/q');
|
||||
expect(printed.begin, const CellOffset(5, 1));
|
||||
expect(printed.end, const CellOffset(20, 1));
|
||||
});
|
||||
}
|
||||
@@ -8,8 +8,9 @@ import 'terminal_view_harness.dart';
|
||||
|
||||
const _field = ValueKey('terminal-find-field');
|
||||
|
||||
String _count(WidgetTester tester) =>
|
||||
tester.widget<Text>(find.byKey(const ValueKey('terminal-find-count'))).data!;
|
||||
String _count(WidgetTester tester) => tester
|
||||
.widget<Text>(find.byKey(const ValueKey('terminal-find-count')))
|
||||
.data!;
|
||||
|
||||
/// Opens the find bar with the platform's key.
|
||||
Future<void> _openFind(WidgetTester tester) => isApple()
|
||||
@@ -106,33 +107,37 @@ void main() {
|
||||
expect(harness.typed, 'x');
|
||||
}, variant: desktops);
|
||||
|
||||
testWidgets('outside Apple platforms Ctrl+F stays the shell\'s', (
|
||||
tester,
|
||||
) async {
|
||||
final harness = TerminalViewHarness();
|
||||
await harness.pump(tester);
|
||||
await harness.focus(tester);
|
||||
await chordKeys(tester, LogicalKeyboardKey.keyF, [
|
||||
LogicalKeyboardKey.controlLeft,
|
||||
]);
|
||||
expect(find.byKey(_field), findsNothing);
|
||||
expect(harness.typed, '\x06');
|
||||
}, variant: TargetPlatformVariant.only(TargetPlatform.linux));
|
||||
testWidgets(
|
||||
'outside Apple platforms Ctrl+F stays the shell\'s',
|
||||
(tester) async {
|
||||
final harness = TerminalViewHarness();
|
||||
await harness.pump(tester);
|
||||
await harness.focus(tester);
|
||||
await chordKeys(tester, LogicalKeyboardKey.keyF, [
|
||||
LogicalKeyboardKey.controlLeft,
|
||||
]);
|
||||
expect(find.byKey(_field), findsNothing);
|
||||
expect(harness.typed, '\x06');
|
||||
},
|
||||
variant: TargetPlatformVariant.only(TargetPlatform.linux),
|
||||
);
|
||||
|
||||
testWidgets('output after a search is found by the next step', (
|
||||
tester,
|
||||
) async {
|
||||
final harness = TerminalViewHarness();
|
||||
await harness.pump(tester);
|
||||
await harness.write(tester, 'one match\r\n');
|
||||
await harness.focus(tester);
|
||||
await _openFind(tester);
|
||||
await tester.enterText(find.byKey(_field), 'match');
|
||||
await tester.pump();
|
||||
expect(_count(tester), '1 of 1');
|
||||
await harness.write(tester, 'two match\r\n');
|
||||
await tester.tap(find.byKey(const ValueKey('terminal-find-next')));
|
||||
await tester.pump();
|
||||
expect(_count(tester), '2 of 2');
|
||||
}, variant: TargetPlatformVariant.only(TargetPlatform.linux));
|
||||
testWidgets(
|
||||
'output after a search is found by the next step',
|
||||
(tester) async {
|
||||
final harness = TerminalViewHarness();
|
||||
await harness.pump(tester);
|
||||
await harness.write(tester, 'one match\r\n');
|
||||
await harness.focus(tester);
|
||||
await _openFind(tester);
|
||||
await tester.enterText(find.byKey(_field), 'match');
|
||||
await tester.pump();
|
||||
expect(_count(tester), '1 of 1');
|
||||
await harness.write(tester, 'two match\r\n');
|
||||
await tester.tap(find.byKey(const ValueKey('terminal-find-next')));
|
||||
await tester.pump();
|
||||
expect(_count(tester), '2 of 2');
|
||||
},
|
||||
variant: TargetPlatformVariant.only(TargetPlatform.linux),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/features/terminal/terminal_layout.dart';
|
||||
|
||||
import 'terminal_view_harness.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Cmd/Ctrl with =, - and 0 zoom a focused terminal; the size '
|
||||
'is saved and the process is resized to the new cells', (tester) async {
|
||||
final store = MemoryStore();
|
||||
final harness = TerminalViewHarness(layout: TerminalLayout(store: store));
|
||||
await harness.pump(tester);
|
||||
await harness.focus(tester);
|
||||
final base = harness.view(tester).textStyle.fontSize;
|
||||
final cols = harness.terminal.viewWidth;
|
||||
final command = commandKey();
|
||||
await chordKeys(tester, LogicalKeyboardKey.equal, [command]);
|
||||
await chordKeys(tester, LogicalKeyboardKey.equal, [command]);
|
||||
expect(harness.layout.fontSize, base.roundToDouble() + 2);
|
||||
expect(harness.view(tester).textStyle.fontSize, base.roundToDouble() + 2);
|
||||
// Larger cells: fewer columns, through the normal resize path.
|
||||
expect(harness.terminal.viewWidth, lessThan(cols));
|
||||
expect(harness.sizes.last.$1, harness.terminal.viewWidth);
|
||||
await tester.pump();
|
||||
expect(jsonDecode(store.saved!)['font_size'], base.roundToDouble() + 2);
|
||||
await chordKeys(tester, LogicalKeyboardKey.minus, [command]);
|
||||
expect(harness.layout.fontSize, base.roundToDouble() + 1);
|
||||
await chordKeys(tester, LogicalKeyboardKey.digit0, [command]);
|
||||
expect(harness.layout.fontSize, isNull);
|
||||
expect(harness.view(tester).textStyle.fontSize, base);
|
||||
expect(harness.terminal.viewWidth, cols);
|
||||
// None of it reached the shell.
|
||||
expect(harness.typed, isEmpty);
|
||||
final restored = TerminalLayout(store: store);
|
||||
await restored.restore();
|
||||
expect(restored.fontSize, isNull);
|
||||
}, variant: desktops);
|
||||
|
||||
testWidgets(
|
||||
'zooming stops at the size limits',
|
||||
(tester) async {
|
||||
final harness = TerminalViewHarness();
|
||||
harness.layout.setFontSize(terminalFontSizeMax - 1);
|
||||
await harness.pump(tester);
|
||||
await harness.focus(tester);
|
||||
for (var i = 0; i < 3; i++) {
|
||||
await chordKeys(tester, LogicalKeyboardKey.equal, [commandKey()]);
|
||||
}
|
||||
expect(harness.layout.fontSize, terminalFontSizeMax);
|
||||
},
|
||||
variant: TargetPlatformVariant.only(TargetPlatform.linux),
|
||||
);
|
||||
|
||||
testWidgets('Shift+PgUp/PgDn/Home/End scroll the scrollback locally; on the '
|
||||
'alternate screen they reach the program', (tester) async {
|
||||
final harness = TerminalViewHarness();
|
||||
await harness.pump(tester);
|
||||
await harness.write(
|
||||
tester,
|
||||
List.generate(200, (i) => 'line $i').join('\r\n'),
|
||||
);
|
||||
await harness.focus(tester);
|
||||
final bottom = harness.scroll(tester).maxScrollExtent;
|
||||
expect(harness.scroll(tester).pixels, bottom);
|
||||
const shift = [LogicalKeyboardKey.shiftLeft];
|
||||
await chordKeys(tester, LogicalKeyboardKey.pageUp, shift);
|
||||
final page = bottom - harness.scroll(tester).pixels;
|
||||
expect(page, greaterThan(0));
|
||||
await chordKeys(tester, LogicalKeyboardKey.pageUp, shift);
|
||||
expect(harness.scroll(tester).pixels, closeTo(bottom - 2 * page, 0.01));
|
||||
await chordKeys(tester, LogicalKeyboardKey.pageDown, shift);
|
||||
expect(harness.scroll(tester).pixels, closeTo(bottom - page, 0.01));
|
||||
await chordKeys(tester, LogicalKeyboardKey.home, shift);
|
||||
expect(harness.scroll(tester).pixels, 0);
|
||||
await chordKeys(tester, LogicalKeyboardKey.end, shift);
|
||||
expect(harness.scroll(tester).pixels, bottom);
|
||||
expect(harness.typed, isEmpty);
|
||||
// A full-screen program (less, vim) gets them.
|
||||
await harness.write(tester, '\x1b[?1049h');
|
||||
await chordKeys(tester, LogicalKeyboardKey.pageUp, shift);
|
||||
expect(harness.typed, '\x1b[5;2~');
|
||||
}, variant: desktops);
|
||||
|
||||
testWidgets('the scrollback setting applies to new and open terminals', (
|
||||
tester,
|
||||
) async {
|
||||
final harness = TerminalViewHarness();
|
||||
expect(harness.layout.scrollback, terminalScrollbackDefault);
|
||||
expect(harness.terminal.maxLines, 10000);
|
||||
await harness.pump(tester);
|
||||
await harness.write(
|
||||
tester,
|
||||
List.generate(1500, (i) => 'line $i').join('\r\n'),
|
||||
);
|
||||
expect(harness.terminal.buffer.height, 1500);
|
||||
harness.layout.setScrollback(1000);
|
||||
await tester.pump();
|
||||
expect(harness.terminal.maxLines, 1000);
|
||||
expect(harness.terminal.buffer.height, 1000);
|
||||
// The newest lines are kept.
|
||||
final buffer = harness.terminal.buffer;
|
||||
expect(buffer.lines[buffer.height - 1].getText().trim(), 'line 1499');
|
||||
expect(buffer.lines[0].getText().trim(), 'line 500');
|
||||
await harness.write(tester, '\r\nmore');
|
||||
expect(harness.terminal.buffer.height, 1000);
|
||||
final next = TerminalViewHarness(layout: harness.layout);
|
||||
addTearDown(next.session.dispose);
|
||||
expect(next.terminal.maxLines, 1000);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'terminal_view_harness.dart';
|
||||
|
||||
Finder _item(String name) => find.byKey(ValueKey('terminal-menu-$name'));
|
||||
|
||||
bool _enabled(WidgetTester tester, String name) =>
|
||||
tester.widget<PopupMenuItem<Object?>>(_item(name)).enabled;
|
||||
|
||||
void main() {
|
||||
testWidgets('right-click offers Copy with a selection, Paste, Select all, '
|
||||
'Clear scrollback and Find', (tester) async {
|
||||
final harness = TerminalViewHarness();
|
||||
await harness.pump(tester);
|
||||
await harness.write(
|
||||
tester,
|
||||
'${List.generate(40, (i) => 'old $i').join('\r\n')}\r\nhello world',
|
||||
);
|
||||
final copied = mockClipboard(tester, paste: 'pasted');
|
||||
final screenTop =
|
||||
harness.terminal.buffer.height - harness.terminal.viewHeight;
|
||||
final last = harness.terminal.buffer.height - 1;
|
||||
await harness.rightClick(tester, 2, last);
|
||||
expect(_item('copy'), findsOneWidget);
|
||||
expect(_enabled(tester, 'copy'), isFalse);
|
||||
for (final name in ['paste', 'selectAll', 'clear', 'find']) {
|
||||
expect(_item(name), findsOneWidget, reason: name);
|
||||
}
|
||||
// Paste types the clipboard into the process.
|
||||
await tester.tap(_item('paste'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(harness.typed, 'pasted');
|
||||
// Select all takes the scrollback too; Copy copies it.
|
||||
await harness.rightClick(tester, 2, last);
|
||||
await tester.tap(_item('selectAll'));
|
||||
await tester.pumpAndSettle();
|
||||
final selection = harness.controller(tester).selection!.normalized;
|
||||
expect(selection.begin.y, 0);
|
||||
expect(selection.end.y, last);
|
||||
await harness.rightClick(tester, 2, last);
|
||||
expect(_enabled(tester, 'copy'), isTrue);
|
||||
await tester.tap(_item('copy'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(copied.single, startsWith('old 0\nold 1'));
|
||||
expect(copied.single, contains('hello world'));
|
||||
// Clear scrollback keeps only the screen.
|
||||
expect(screenTop, greaterThan(0));
|
||||
await harness.rightClick(tester, 2, last);
|
||||
await tester.tap(_item('clear'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(harness.terminal.buffer.height, harness.terminal.viewHeight);
|
||||
// Find… opens the find bar.
|
||||
await harness.rightClick(tester, 2, harness.terminal.viewHeight - 1);
|
||||
await tester.tap(_item('find'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byKey(const ValueKey('terminal-find-field')), findsOneWidget);
|
||||
}, variant: desktops);
|
||||
|
||||
testWidgets('a program tracking the mouse gets the right button unless '
|
||||
'Shift is held', (tester) async {
|
||||
final harness = TerminalViewHarness();
|
||||
await harness.pump(tester);
|
||||
await harness.write(tester, r'$ ');
|
||||
// X10/normal tracking with SGR coordinates.
|
||||
await harness.write(tester, '\x1b[?1000h\x1b[?1006h');
|
||||
await harness.rightClick(tester, 3, 0);
|
||||
expect(_item('copy'), findsNothing);
|
||||
expect(harness.typed, '\x1b[<2;4;1M\x1b[<2;4;1m');
|
||||
await harness.rightClick(tester, 3, 0, shift: true);
|
||||
expect(_item('copy'), findsOneWidget);
|
||||
}, variant: TargetPlatformVariant.only(TargetPlatform.linux));
|
||||
|
||||
testWidgets('finished output offers no Paste', (tester) async {
|
||||
final harness = TerminalViewHarness(live: false);
|
||||
await harness.pump(tester);
|
||||
await harness.rightClick(tester, 1, 0);
|
||||
expect(_item('copy'), findsOneWidget);
|
||||
expect(_item('paste'), findsNothing);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user