Merge commit '40623991e8709e5c1ab3e875b51d4de55f0c20a5' into pipelines/run-20261112-0206-composer-border-shows-the-agent-working-fd87
This commit is contained in:
@@ -133,9 +133,8 @@ void main() {
|
||||
await tester.pumpWidget(const SizedBox.shrink());
|
||||
});
|
||||
|
||||
testWidgets('single pane focuses input; empty workspace does not consume', (
|
||||
tester,
|
||||
) async {
|
||||
testWidgets('single pane with no shown window does nothing; empty workspace '
|
||||
'does not consume', (tester) async {
|
||||
await _setup(tester, open: false);
|
||||
await _chord(tester);
|
||||
expect(find.byType(ChatWorkspace), findsNothing);
|
||||
@@ -144,7 +143,9 @@ void main() {
|
||||
_focusSidebar(tester);
|
||||
await tester.pumpAndSettle();
|
||||
await _chord(tester);
|
||||
expect(_editable(tester, 'a').focusNode.hasPrimaryFocus, isTrue);
|
||||
expect(find.byType(ChatWorkspace), findsOneWidget);
|
||||
expect(_workspace(tester).paneCount, 1);
|
||||
expect(_editable(tester, 'a').focusNode.hasPrimaryFocus, isFalse);
|
||||
expect(_editable(tester, 'a').controller.text, isEmpty);
|
||||
await tester.pumpWidget(const SizedBox.shrink());
|
||||
});
|
||||
|
||||
@@ -531,25 +531,36 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
expect(app.floating, ['b', 'c', 'a']);
|
||||
|
||||
// The cycle follows the order the windows were opened in (b, c, a), not
|
||||
// the stacking order, which each raise changes. From a (opened last) the
|
||||
// next is b, the first opened.
|
||||
await _tab(tester);
|
||||
expect(app.floating, ['c', 'a', 'b']);
|
||||
expect(_composerFocused(tester, 'b'), isTrue);
|
||||
// Past the top, the bottom window comes up again.
|
||||
await _tab(tester);
|
||||
expect(app.floating, ['a', 'b', 'c']);
|
||||
expect(_composerFocused(tester, 'c'), isTrue);
|
||||
await _tab(tester);
|
||||
expect(app.floating, ['b', 'c', 'a']);
|
||||
expect(_composerFocused(tester, 'a'), isTrue);
|
||||
await _tab(tester, shift: true);
|
||||
expect(app.floating, ['b', 'a', 'c']);
|
||||
expect(_composerFocused(tester, 'c'), isTrue);
|
||||
await _tab(tester, shift: true);
|
||||
expect(app.floating, ['a', 'c', 'b']);
|
||||
expect(_composerFocused(tester, 'b'), isTrue);
|
||||
// Back past the first opened: the last opened (a) comes up.
|
||||
await _tab(tester, shift: true);
|
||||
expect(app.floating, ['a', 'b', 'c']);
|
||||
expect(_composerFocused(tester, 'c'), isTrue);
|
||||
expect(app.floating, ['c', 'b', 'a']);
|
||||
expect(_composerFocused(tester, 'a'), isTrue);
|
||||
expect(tester.takeException(), isNull);
|
||||
await app.stop(tester);
|
||||
});
|
||||
|
||||
testWidgets('with the tiling focused Ctrl+Tab cycles its panes and leaves '
|
||||
'the windows alone', (tester) async {
|
||||
testWidgets('with the tiling focused Ctrl+Tab goes to the top-most shown '
|
||||
'window, and cycles the panes only when no window is shown', (
|
||||
tester,
|
||||
) async {
|
||||
await _saved('a', 'b', 'c');
|
||||
final app = _App(_Store());
|
||||
await app.start(tester);
|
||||
@@ -557,26 +568,61 @@ void main() {
|
||||
expect(app.floating, ['c']);
|
||||
final controller = _workspace(tester);
|
||||
|
||||
// A window is shown: from the tiling, Ctrl+Tab takes the keyboard to it
|
||||
// and the panes stay where they are.
|
||||
await tester.tapAt(tester.getCenter(_input('a')));
|
||||
await tester.pump();
|
||||
expect(controller.activePane?.sessionId, 'a');
|
||||
await _tab(tester);
|
||||
expect(controller.activePane?.sessionId, 'b');
|
||||
expect(_composerFocused(tester, 'b'), isTrue);
|
||||
expect(controller.activePane?.sessionId, 'a');
|
||||
expect(_composerFocused(tester, 'c'), isTrue);
|
||||
expect(app.floating, ['c']);
|
||||
|
||||
// With a window focused, the panes stay where they are; a single window
|
||||
// has nothing to cycle to.
|
||||
await tester.tapAt(tester.getCenter(_input('c')));
|
||||
await tester.pump();
|
||||
// A single shown window has nothing to cycle to.
|
||||
await _tab(tester);
|
||||
expect(controller.activePane?.sessionId, 'a');
|
||||
expect(_composerFocused(tester, 'c'), isTrue);
|
||||
expect(app.floating, ['c']);
|
||||
|
||||
// No window shown: the panes cycle and the hidden window stays hidden.
|
||||
await _chord(tester);
|
||||
expect(_shown('Chat c'), findsNothing);
|
||||
await tester.tapAt(tester.getCenter(_input('a')));
|
||||
await tester.pump();
|
||||
await _tab(tester);
|
||||
expect(controller.activePane?.sessionId, 'b');
|
||||
expect(_composerFocused(tester, 'b'), isTrue);
|
||||
expect(_shown('Chat c'), findsNothing);
|
||||
expect(app.floating, ['c']);
|
||||
expect(tester.takeException(), isNull);
|
||||
await app.stop(tester);
|
||||
});
|
||||
|
||||
testWidgets('with one tiled pane and no shown window Ctrl+Tab does nothing; '
|
||||
'a minimised chat is not brought up', (tester) async {
|
||||
await _saved('a', 'b');
|
||||
final app = _App(_Store());
|
||||
await app.start(tester);
|
||||
await _menu(tester, 'b', 'Float (Alt+Y)');
|
||||
await tester.tap(find.byTooltip('Minimise'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(_shown('Chat b'), findsNothing);
|
||||
final controller = _workspace(tester);
|
||||
expect(controller.panes.map((p) => p.sessionId), ['a']);
|
||||
|
||||
await tester.tapAt(tester.getCenter(_input('a')));
|
||||
await tester.pump();
|
||||
await _tab(tester);
|
||||
await _tab(tester, shift: true);
|
||||
expect(controller.panes.map((p) => p.sessionId), ['a']);
|
||||
expect(controller.activePane?.sessionId, 'a');
|
||||
expect(_shown('Chat b'), findsNothing);
|
||||
expect(app.floating, ['b']);
|
||||
expect(app.opened, isEmpty);
|
||||
expect(tester.takeException(), isNull);
|
||||
await app.stop(tester);
|
||||
});
|
||||
|
||||
testWidgets('a terminal that claims tab keys keeps Ctrl+Tab over a focused '
|
||||
'floating chat', (tester) async {
|
||||
await _saved('a', 'b', 'c');
|
||||
|
||||
@@ -150,38 +150,29 @@ void main() {
|
||||
await tester.pumpWidget(const SizedBox.shrink());
|
||||
});
|
||||
|
||||
testWidgets('Control Tab over one pane returns to the previous chat', (
|
||||
tester,
|
||||
) async {
|
||||
testWidgets('Control Tab over one pane does nothing: it never brings up '
|
||||
'another chat', (tester) async {
|
||||
await _setup(tester);
|
||||
await _openRow(tester, 'a');
|
||||
final workspace = _workspace(tester);
|
||||
// Nothing shown before: the chord only focuses the composer.
|
||||
await _controlTab(tester);
|
||||
expect(workspace.activePane?.sessionId, 'a');
|
||||
expect(_editable(tester, 'a').focusNode.hasPrimaryFocus, isTrue);
|
||||
expect(_editable(tester, 'a').focusNode.hasPrimaryFocus, isFalse);
|
||||
|
||||
// Opening b replaces the lone pane; a is no longer shown anywhere.
|
||||
await _openRow(tester, 'b');
|
||||
await tester.enterText(_input('b'), 'Draft B');
|
||||
await _focusSidebar(tester);
|
||||
for (final id in ['a', 'b', 'a']) {
|
||||
await _controlTab(tester);
|
||||
for (final shift in [false, true]) {
|
||||
await _controlTab(tester, shift: shift);
|
||||
expect(workspace.paneCount, 1);
|
||||
expect(workspace.activePane?.sessionId, id);
|
||||
expect(_editable(tester, id).focusNode.hasPrimaryFocus, isTrue);
|
||||
expect(workspace.activePane?.sessionId, 'b');
|
||||
expect(_editable(tester, 'b').focusNode.hasPrimaryFocus, isFalse);
|
||||
expect(_editable(tester, 'b').controller.text, 'Draft B');
|
||||
}
|
||||
await _controlTab(tester, shift: true);
|
||||
expect(workspace.activePane?.sessionId, 'b');
|
||||
expect(_editable(tester, 'b').controller.text, 'Draft B');
|
||||
|
||||
// A third chat makes the pair c and b; a is no longer one step away.
|
||||
// Two panes cycle the panes, not the history.
|
||||
await _openRow(tester, 'c');
|
||||
await _controlTab(tester);
|
||||
expect(workspace.activePane?.sessionId, 'b');
|
||||
await _controlTab(tester);
|
||||
expect(workspace.activePane?.sessionId, 'c');
|
||||
|
||||
// Two panes cycle the panes as before, not the history.
|
||||
await tester.tap(_actions('a'));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.text('Open to the right'));
|
||||
|
||||
@@ -50,7 +50,7 @@ Future<void> _pumpShell(WidgetTester tester, Size size) async {
|
||||
|
||||
void main() {
|
||||
for (final size in [const Size(1280, 800), const Size(800, 830)]) {
|
||||
testWidgets('a wide window keeps the tab bar and list beside the open chat '
|
||||
testWidgets('a wide window keeps the rail and list beside the open chat '
|
||||
'at $size', (tester) async {
|
||||
await _pumpShell(tester, size);
|
||||
expect(
|
||||
@@ -68,8 +68,10 @@ void main() {
|
||||
find.byType(Navigator).first,
|
||||
);
|
||||
expect(navigator.canPop(), isFalse, reason: 'No page covers the shell');
|
||||
expect(find.byType(NavigationRail), findsNothing);
|
||||
expect(find.byType(FloatingDestinationBar), findsOneWidget);
|
||||
// Both sizes are wide enough for the rail (the shell's own bar and list
|
||||
// beside the open chat sit to its right).
|
||||
expect(find.byType(NavigationRail), findsOneWidget);
|
||||
expect(find.byType(FloatingDestinationBar), findsNothing);
|
||||
expect(find.byKey(const ValueKey('chat-thread-a')), findsOneWidget);
|
||||
expect(find.text('Second chat'), findsOneWidget);
|
||||
expect(
|
||||
|
||||
@@ -11,7 +11,7 @@ void main() {
|
||||
testWidgets('chat list stays above labeled navigation ($scale)', (
|
||||
tester,
|
||||
) async {
|
||||
tester.view.physicalSize = const Size(1200, 900);
|
||||
tester.view.physicalSize = const Size(640, 900);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
tester.platformDispatcher.textScaleFactorTestValue = scale;
|
||||
addTearDown(tester.view.reset);
|
||||
@@ -87,7 +87,13 @@ void main() {
|
||||
),
|
||||
same(scrollable),
|
||||
);
|
||||
expect(scrollable.position.pixels, closeTo(retainedOffset, .5));
|
||||
// The list is narrower at 640 (no rail) than beside the rail, so its
|
||||
// rows re-wrap into a shorter scroll extent: the offset is kept up to
|
||||
// that extent, and no further.
|
||||
final kept = retainedOffset < scrollable.position.maxScrollExtent
|
||||
? retainedOffset
|
||||
: scrollable.position.maxScrollExtent;
|
||||
expect(scrollable.position.pixels, closeTo(kept, .5));
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -106,7 +106,16 @@ void main() {
|
||||
expect(find.text('Menu'), findsOneWidget);
|
||||
await tester.tap(find.text('Menu'));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.text('Runs'));
|
||||
// The menu's own row: the rail labels Runs too, so take the text that
|
||||
// is not in the rail.
|
||||
await tester.tap(
|
||||
find.byElementPredicate(
|
||||
(element) =>
|
||||
element.widget is Text &&
|
||||
(element.widget as Text).data == 'Runs' &&
|
||||
element.findAncestorWidgetOfExactType<NavigationRail>() == null,
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Runs destination'), findsOneWidget);
|
||||
await tester.tap(find.byTooltip('Chat'));
|
||||
|
||||
Reference in New Issue
Block a user