Float the last chat and float from the chat list
Any tiled chat can float now, including the only one; the tiling is left empty. A chat list row's More menu offers Float too: a tiled chat leaves the tiling, a chat with a window shows it, any other opens a new window.
This commit is contained in:
@@ -247,7 +247,7 @@ void main() {
|
||||
findsOneWidget,
|
||||
);
|
||||
|
||||
// The lone tiled pane cannot float: the tiling would be empty.
|
||||
// The lone tiled pane can float too.
|
||||
await tester.tap(
|
||||
find
|
||||
.descendant(
|
||||
@@ -257,7 +257,7 @@ void main() {
|
||||
.hitTestable(),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.textContaining('Float'), findsNothing);
|
||||
expect(find.text('Float (Alt+Y)'), findsOneWidget);
|
||||
await tester.tapAt(const Offset(5, 995));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
@@ -277,6 +277,62 @@ void main() {
|
||||
await app.stop(tester);
|
||||
});
|
||||
|
||||
testWidgets('the last tiled chat floats and leaves the tiling empty', (
|
||||
tester,
|
||||
) async {
|
||||
await _saved('a', 'b');
|
||||
final app = _App(_Store());
|
||||
await app.start(tester);
|
||||
await _menu(tester, 'b', 'Float (Alt+Y)');
|
||||
final controller = _workspace(tester);
|
||||
final a = tester.state(_thread('a'));
|
||||
await _menu(tester, 'a', 'Float (Alt+Y)');
|
||||
expect(app.floating, ['b', 'a']);
|
||||
expect(controller.paneCount, 0);
|
||||
expect(tester.state(_thread('a')), same(a));
|
||||
await tester.tap(
|
||||
find.descendant(of: _window('Chat a'), matching: find.byTooltip('Dock')),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
expect(app.floating, ['b']);
|
||||
expect(_workspace(tester).panes.map((p) => p.sessionId), ['a']);
|
||||
expect(tester.state(_thread('a')), same(a));
|
||||
expect(tester.takeException(), isNull);
|
||||
await app.stop(tester);
|
||||
});
|
||||
|
||||
testWidgets('the chat list More menu floats a chat', (tester) async {
|
||||
await _saved('a', 'b');
|
||||
final app = _App(_Store());
|
||||
await app.start(tester);
|
||||
// Windows sit over the list, so each choice is made with them hidden.
|
||||
Future<void> listFloat(String id) async {
|
||||
app.manager.setGroupShown(chatWindowKind, false);
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.byTooltip('Chat actions for Chat $id').first);
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.text('Float (Alt+Y)').last);
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
|
||||
// A tiled chat leaves the tiling for its window, keeping its view.
|
||||
final b = tester.state(_thread('b'));
|
||||
await listFloat('b');
|
||||
expect(app.floating, ['b']);
|
||||
expect(_workspace(tester).panes.map((p) => p.sessionId), ['a']);
|
||||
expect(tester.state(_thread('b')), same(b));
|
||||
// A chat that is not open gets a window of its own.
|
||||
await listFloat('c');
|
||||
expect(app.floating, ['b', 'c']);
|
||||
expect(_workspace(tester).panes.map((p) => p.sessionId), ['a']);
|
||||
// A chat that already has a window shows it instead of opening another.
|
||||
await listFloat('b');
|
||||
expect(app.floating, unorderedEquals(['b', 'c']));
|
||||
expect(_shown('Chat b'), findsOneWidget);
|
||||
expect(tester.takeException(), isNull);
|
||||
await app.stop(tester);
|
||||
});
|
||||
|
||||
testWidgets('X closes the window and returns nothing to the tiling', (
|
||||
tester,
|
||||
) async {
|
||||
|
||||
@@ -53,11 +53,8 @@ Future<void> _setup(WidgetTester tester) async {
|
||||
destination: AppDestination.chat,
|
||||
destinationBodies: {
|
||||
AppDestination.chat: (_) => ChatScreen(gateway: gateway),
|
||||
AppDestination.search: (_) => SearchScreen(
|
||||
gateway: gateway,
|
||||
onOpen: (_) {},
|
||||
embedded: true,
|
||||
),
|
||||
AppDestination.search: (_) =>
|
||||
SearchScreen(gateway: gateway, onOpen: (_) {}, embedded: true),
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
@@ -148,7 +148,7 @@ void main() {
|
||||
addTearDown(gateway.pushed.close);
|
||||
await controller.refresh();
|
||||
await mountPicker(tester, controller, folds);
|
||||
await controller.hide('b');
|
||||
await controller.hide('b');
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byKey(const Key('chat-row-b')), findsNothing);
|
||||
folds.set('Closed', false);
|
||||
|
||||
@@ -491,26 +491,29 @@ void main() {
|
||||
);
|
||||
}
|
||||
|
||||
test('Alt+E toggles by physical key position, including Option dead keys', () {
|
||||
const event = KeyDownEvent(
|
||||
physicalKey: PhysicalKeyboardKey.keyE,
|
||||
logicalKey: LogicalKeyboardKey(0x00B4),
|
||||
character: '´',
|
||||
timeStamp: Duration.zero,
|
||||
);
|
||||
expect(chatCenterStageShortcut(event, _AltHeld()), isTrue);
|
||||
expect(
|
||||
chatCenterStageShortcut(
|
||||
const KeyUpEvent(
|
||||
physicalKey: PhysicalKeyboardKey.keyE,
|
||||
logicalKey: LogicalKeyboardKey(0x00B4),
|
||||
timeStamp: Duration.zero,
|
||||
test(
|
||||
'Alt+E toggles by physical key position, including Option dead keys',
|
||||
() {
|
||||
const event = KeyDownEvent(
|
||||
physicalKey: PhysicalKeyboardKey.keyE,
|
||||
logicalKey: LogicalKeyboardKey(0x00B4),
|
||||
character: '´',
|
||||
timeStamp: Duration.zero,
|
||||
);
|
||||
expect(chatCenterStageShortcut(event, _AltHeld()), isTrue);
|
||||
expect(
|
||||
chatCenterStageShortcut(
|
||||
const KeyUpEvent(
|
||||
physicalKey: PhysicalKeyboardKey.keyE,
|
||||
logicalKey: LogicalKeyboardKey(0x00B4),
|
||||
timeStamp: Duration.zero,
|
||||
),
|
||||
_AltHeld(),
|
||||
),
|
||||
_AltHeld(),
|
||||
),
|
||||
isFalse,
|
||||
);
|
||||
});
|
||||
isFalse,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
testWidgets('Alt+E toggles from a focused composer without typing', (
|
||||
tester,
|
||||
|
||||
@@ -27,13 +27,17 @@ void main() {
|
||||
expect(c.holdsSession('b'), isFalse);
|
||||
});
|
||||
|
||||
test('a lone pane cannot leave: the tiling never empties by floating', () {
|
||||
test('the lone pane floats too and leaves the tiling empty', () {
|
||||
final c = ChatWorkspaceController()..open('a');
|
||||
final only = c.panes.single;
|
||||
expect(c.canFloat(only.id), isFalse);
|
||||
expect(c.detach(only.id), isNull);
|
||||
expect(c.canFloat(only.id), isTrue);
|
||||
expect(c.detach('nope'), isNull);
|
||||
expect(c.detach(only.id)?.sessionId, 'a');
|
||||
expect(c.paneCount, 0);
|
||||
expect(c.activePane, isNull);
|
||||
c.dock('a');
|
||||
expect(_sessions(c), ['a']);
|
||||
expect(c.activePane?.sessionId, 'a');
|
||||
});
|
||||
|
||||
test('dock puts the chat right of the active pane and activates it', () {
|
||||
|
||||
Reference in New Issue
Block a user