Merge main: pane moves alongside center stage
This commit is contained in:
@@ -0,0 +1,308 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/features/chat/workspace/chat_center_stage_controller.dart';
|
||||
import 'package:pipelines_app/features/chat/workspace/chat_center_stage_keys.dart';
|
||||
import 'package:pipelines_app/features/chat/workspace/chat_center_stage_layout.dart';
|
||||
import 'package:pipelines_app/features/chat/workspace/chat_center_stage_strip.dart';
|
||||
import 'package:pipelines_app/features/chat/workspace/chat_workspace.dart';
|
||||
import 'package:pipelines_app/features/chat/workspace/chat_workspace_geometry.dart';
|
||||
|
||||
class _MemoryStore implements ChatCenterStageStore {
|
||||
_MemoryStore();
|
||||
bool? saved;
|
||||
@override
|
||||
Future<bool?> load() async => saved;
|
||||
@override
|
||||
Future<bool> save(bool on) async {
|
||||
saved = on;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class _Draft extends StatefulWidget {
|
||||
const _Draft({super.key, required this.name});
|
||||
final String name;
|
||||
@override
|
||||
State<_Draft> createState() => _DraftState();
|
||||
}
|
||||
|
||||
class _DraftState extends State<_Draft> {
|
||||
final text = TextEditingController();
|
||||
@override
|
||||
void dispose() {
|
||||
text.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) =>
|
||||
TextField(key: ValueKey('input-${widget.name}'), controller: text);
|
||||
}
|
||||
|
||||
Widget host(
|
||||
ChatWorkspaceController workspace,
|
||||
ChatCenterStageController stage, {
|
||||
double width = 1368,
|
||||
bool singlePane = false,
|
||||
bool reduceMotion = false,
|
||||
List<KeyEvent>? fieldKeys,
|
||||
}) => MaterialApp(
|
||||
home: MediaQuery(
|
||||
data: MediaQueryData(disableAnimations: reduceMotion),
|
||||
child: Scaffold(
|
||||
body: Align(
|
||||
alignment: Alignment.topLeft,
|
||||
child: SizedBox(
|
||||
width: width,
|
||||
height: 800,
|
||||
child: ChatCenterStageKeys(
|
||||
controller: stage,
|
||||
enabled: () => !singlePane,
|
||||
child: ChatWorkspace(
|
||||
controller: workspace,
|
||||
centerStage: stage,
|
||||
singlePane: singlePane,
|
||||
paneTitle: (pane) => pane.sessionId,
|
||||
paneBuilder: (_, pane, active) => Focus(
|
||||
onKeyEvent: (_, event) {
|
||||
fieldKeys?.add(event);
|
||||
return KeyEventResult.ignored;
|
||||
},
|
||||
child: _Draft(
|
||||
key: ValueKey(pane.sessionId),
|
||||
name: pane.sessionId,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
ChatWorkspaceController threePanes() => ChatWorkspaceController()
|
||||
..open('one')
|
||||
..splitActive('two', ChatSplitAxis.horizontal)
|
||||
..splitActive('three', ChatSplitAxis.horizontal);
|
||||
|
||||
void wide(WidgetTester tester) {
|
||||
tester.view
|
||||
..physicalSize = const Size(1600, 1000)
|
||||
..devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
}
|
||||
|
||||
double widthOf(WidgetTester tester, String session) =>
|
||||
tester.getSize(find.byKey(ValueKey('input-$session'))).width;
|
||||
|
||||
void main() {
|
||||
group('layout', () {
|
||||
test(
|
||||
'stage is the reading width plus a quarter, others share the rest',
|
||||
() {
|
||||
final layout = ChatCenterStageLayout.of(const Size(1368, 800), [
|
||||
'a',
|
||||
'b',
|
||||
'c',
|
||||
], 'b')!;
|
||||
expect(chatCenterStageWidth, 950);
|
||||
expect(layout.rects['b'], const Rect.fromLTWH(209, 0, 950, 800));
|
||||
expect(layout.rects['a'], const Rect.fromLTWH(0, 0, 197, 800));
|
||||
expect(layout.rects['c']!.right, 1368);
|
||||
expect(layout.strips, {'a', 'c'});
|
||||
expect(layout.neighbor('b', ChatPaneDirection.left), 'a');
|
||||
expect(layout.neighbor('b', ChatPaneDirection.right), 'c');
|
||||
expect(layout.neighbor('b', ChatPaneDirection.up), isNull);
|
||||
},
|
||||
);
|
||||
|
||||
test('a narrow workspace caps the stage to leave every strip', () {
|
||||
final layout = ChatCenterStageLayout.of(const Size(700, 800), [
|
||||
'a',
|
||||
'b',
|
||||
'c',
|
||||
], 'a')!;
|
||||
expect(layout.rects['a']!.width, 700 - 24 - 2 * 56);
|
||||
expect(layout.rects['c']!.right, 700);
|
||||
expect(
|
||||
ChatCenterStageLayout.of(const Size(300, 800), ['a', 'b'], 'a'),
|
||||
isNull,
|
||||
);
|
||||
});
|
||||
|
||||
test('a very wide workspace keeps the stage and shows live columns', () {
|
||||
final layout = ChatCenterStageLayout.of(const Size(2560, 800), [
|
||||
'a',
|
||||
'b',
|
||||
], 'a')!;
|
||||
expect(layout.rects['a']!.width, 950);
|
||||
expect(layout.strips, isEmpty);
|
||||
expect(
|
||||
ChatCenterStageLayout.of(const Size(2560, 800), ['a'], 'a'),
|
||||
isNull,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
testWidgets('toggling stages the active chat, keeps drafts and split sizes', (
|
||||
tester,
|
||||
) async {
|
||||
wide(tester);
|
||||
final workspace = threePanes();
|
||||
final stage = ChatCenterStageController(store: _MemoryStore());
|
||||
addTearDown(workspace.dispose);
|
||||
addTearDown(stage.dispose);
|
||||
final split = (workspace.root! as ChatWorkspaceSplit).id;
|
||||
workspace.resize(split, .3);
|
||||
await tester.pumpWidget(host(workspace, stage));
|
||||
await tester.enterText(find.byKey(const ValueKey('input-three')), 'draft');
|
||||
final before = {
|
||||
for (final id in ['one', 'two', 'three']) id: widthOf(tester, id),
|
||||
};
|
||||
|
||||
stage.value = true;
|
||||
await tester.pump();
|
||||
await tester.pump(const Duration(milliseconds: 40));
|
||||
// Mid-flight the stage is on its way, neither split nor staged.
|
||||
expect(widthOf(tester, 'three'), inExclusiveRange(before['three']!, 950));
|
||||
await tester.pumpAndSettle();
|
||||
expect(widthOf(tester, 'three'), 950);
|
||||
expect(find.byType(ChatCenterStageStrip), findsNWidgets(2));
|
||||
expect(find.text('draft'), findsOneWidget);
|
||||
|
||||
stage.value = false;
|
||||
await tester.pumpAndSettle();
|
||||
for (final id in before.keys) {
|
||||
expect(widthOf(tester, id), before[id]);
|
||||
}
|
||||
expect((workspace.root! as ChatWorkspaceSplit).ratio, .3);
|
||||
expect(find.byType(ChatCenterStageStrip), findsNothing);
|
||||
expect(find.text('draft'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('the stage follows the active chat and strip presses', (
|
||||
tester,
|
||||
) async {
|
||||
wide(tester);
|
||||
final workspace = threePanes();
|
||||
final stage = ChatCenterStageController(store: _MemoryStore())
|
||||
..value = true;
|
||||
addTearDown(workspace.dispose);
|
||||
addTearDown(stage.dispose);
|
||||
await tester.pumpWidget(host(workspace, stage));
|
||||
await tester.enterText(find.byKey(const ValueKey('input-three')), 'kept');
|
||||
expect(widthOf(tester, 'three'), 950);
|
||||
|
||||
workspace.activate(workspace.panes.first.id);
|
||||
await tester.pumpAndSettle();
|
||||
expect(widthOf(tester, 'one'), 950);
|
||||
expect(widthOf(tester, 'three'), chatPaneMinimumWidth);
|
||||
|
||||
await tester.tap(find.bySemanticsLabel('Show two on center stage'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(workspace.activePane?.sessionId, 'two');
|
||||
expect(widthOf(tester, 'two'), 950);
|
||||
expect(find.text('kept'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('reduced motion stages at once', (tester) async {
|
||||
wide(tester);
|
||||
final workspace = threePanes();
|
||||
final stage = ChatCenterStageController(store: _MemoryStore());
|
||||
addTearDown(workspace.dispose);
|
||||
addTearDown(stage.dispose);
|
||||
await tester.pumpWidget(host(workspace, stage, reduceMotion: true));
|
||||
stage.value = true;
|
||||
await tester.pump();
|
||||
expect(widthOf(tester, 'three'), 950);
|
||||
});
|
||||
|
||||
testWidgets('phones keep their one-chat layout', (tester) async {
|
||||
final workspace = threePanes();
|
||||
final stage = ChatCenterStageController(store: _MemoryStore())
|
||||
..value = true;
|
||||
addTearDown(workspace.dispose);
|
||||
addTearDown(stage.dispose);
|
||||
await tester.pumpWidget(
|
||||
host(workspace, stage, width: 400, singlePane: true),
|
||||
);
|
||||
expect(widthOf(tester, 'three'), 400);
|
||||
expect(find.byType(ChatCenterStageStrip), findsNothing);
|
||||
await tester.sendKeyDownEvent(LogicalKeyboardKey.controlLeft);
|
||||
await tester.sendKeyEvent(LogicalKeyboardKey.keyE);
|
||||
await tester.sendKeyUpEvent(LogicalKeyboardKey.controlLeft);
|
||||
expect(stage.value, isTrue);
|
||||
});
|
||||
|
||||
for (final mac in [false, true]) {
|
||||
testWidgets(
|
||||
'${mac ? 'Cmd' : 'Ctrl'}+E toggles; a plain e reaches the field',
|
||||
(tester) async {
|
||||
wide(tester);
|
||||
debugDefaultTargetPlatformOverride = mac
|
||||
? TargetPlatform.macOS
|
||||
: TargetPlatform.linux;
|
||||
final workspace = threePanes();
|
||||
final store = _MemoryStore();
|
||||
final stage = ChatCenterStageController(store: store);
|
||||
addTearDown(workspace.dispose);
|
||||
addTearDown(stage.dispose);
|
||||
final keys = <KeyEvent>[];
|
||||
await tester.pumpWidget(host(workspace, stage, fieldKeys: keys));
|
||||
await tester.tap(find.byKey(const ValueKey('input-three')));
|
||||
await tester.pump();
|
||||
|
||||
await tester.sendKeyEvent(LogicalKeyboardKey.keyE);
|
||||
expect(stage.value, isFalse);
|
||||
expect(keys.whereType<KeyDownEvent>(), hasLength(1));
|
||||
|
||||
final modifier = mac
|
||||
? LogicalKeyboardKey.metaLeft
|
||||
: LogicalKeyboardKey.controlLeft;
|
||||
final other = mac
|
||||
? LogicalKeyboardKey.controlLeft
|
||||
: LogicalKeyboardKey.metaLeft;
|
||||
keys.clear();
|
||||
await tester.sendKeyDownEvent(modifier);
|
||||
await tester.sendKeyEvent(LogicalKeyboardKey.keyE);
|
||||
await tester.sendKeyUpEvent(modifier);
|
||||
expect(stage.value, isTrue);
|
||||
expect(store.saved, isTrue);
|
||||
expect(
|
||||
keys.whereType<KeyDownEvent>().map((e) => e.logicalKey),
|
||||
isNot(contains(LogicalKeyboardKey.keyE)),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
expect(widthOf(tester, 'three'), 950);
|
||||
|
||||
// The other platform's chord stays with the field (Ctrl+E on a Mac is
|
||||
// its end of line).
|
||||
await tester.sendKeyDownEvent(other);
|
||||
await tester.sendKeyEvent(LogicalKeyboardKey.keyE);
|
||||
await tester.sendKeyUpEvent(other);
|
||||
expect(stage.value, isTrue);
|
||||
debugDefaultTargetPlatformOverride = null;
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
test('the choice is remembered', () async {
|
||||
final store = _MemoryStore();
|
||||
final first = ChatCenterStageController(store: store)..toggle();
|
||||
await Future<void>.delayed(Duration.zero);
|
||||
expect(store.saved, isTrue);
|
||||
first.dispose();
|
||||
final next = ChatCenterStageController(store: store);
|
||||
await next.restore();
|
||||
expect(next.value, isTrue);
|
||||
next.dispose();
|
||||
});
|
||||
|
||||
test('labels name the platform chord', () {
|
||||
expect(chatCenterStageShortcutLabel(TargetPlatform.macOS), 'Cmd+E');
|
||||
expect(chatCenterStageShortcutLabel(TargetPlatform.windows), 'Ctrl+E');
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,238 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/features/chat/workspace/chat_pane_move_shortcuts.dart';
|
||||
import 'package:pipelines_app/features/chat/workspace/chat_workspace.dart';
|
||||
import 'package:pipelines_app/features/chat/workspace/chat_workspace_geometry.dart';
|
||||
import 'package:pipelines_app/features/chat/workspace/chat_workspace_snapshot.dart';
|
||||
|
||||
/// a | (b over (c | d)): a on the left, b top right, c and d below b.
|
||||
ChatWorkspaceController _nested() {
|
||||
final controller = ChatWorkspaceController()..open('a');
|
||||
controller.splitActive('b', ChatSplitAxis.horizontal);
|
||||
controller.splitActive('c', ChatSplitAxis.vertical);
|
||||
controller.splitActive('d', ChatSplitAxis.horizontal);
|
||||
return controller;
|
||||
}
|
||||
|
||||
String _id(ChatWorkspaceController controller, String session) =>
|
||||
controller.panes.firstWhere((pane) => pane.sessionId == session).id;
|
||||
|
||||
Map<ChatPaneDirection, String?> _targets(
|
||||
ChatWorkspaceController controller,
|
||||
String session,
|
||||
) {
|
||||
final geometry = ChatWorkspaceGeometry(
|
||||
controller.root!,
|
||||
const Size(1200, 800),
|
||||
);
|
||||
final names = {for (final p in controller.panes) p.id: p.sessionId};
|
||||
return {
|
||||
for (final direction in ChatPaneDirection.values)
|
||||
direction: names[geometry.adjacent(_id(controller, session), direction)],
|
||||
};
|
||||
}
|
||||
|
||||
class _Draft extends StatefulWidget {
|
||||
const _Draft({super.key, required this.name});
|
||||
final String name;
|
||||
@override
|
||||
State<_Draft> createState() => _DraftState();
|
||||
}
|
||||
|
||||
class _DraftState extends State<_Draft> {
|
||||
final text = TextEditingController();
|
||||
@override
|
||||
void dispose() {
|
||||
text.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) =>
|
||||
TextField(key: ValueKey('input-${widget.name}'), controller: text);
|
||||
}
|
||||
|
||||
Widget _host(ChatWorkspaceController controller, {bool reduce = false}) =>
|
||||
MaterialApp(
|
||||
home: MediaQuery(
|
||||
data: MediaQueryData(
|
||||
size: const Size(1200, 800),
|
||||
disableAnimations: reduce,
|
||||
),
|
||||
child: Scaffold(
|
||||
body: SizedBox(
|
||||
width: 1200,
|
||||
height: 800,
|
||||
child: ChatWorkspace(
|
||||
controller: controller,
|
||||
paneBuilder: (_, pane, _) =>
|
||||
_Draft(key: ValueKey(pane.sessionId), name: pane.sessionId),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Future<void> _chord(WidgetTester tester, LogicalKeyboardKey arrow) async {
|
||||
await tester.sendKeyDownEvent(LogicalKeyboardKey.controlLeft);
|
||||
await tester.sendKeyDownEvent(LogicalKeyboardKey.altLeft);
|
||||
await tester.sendKeyDownEvent(LogicalKeyboardKey.shiftLeft);
|
||||
await tester.sendKeyEvent(arrow);
|
||||
await tester.sendKeyUpEvent(LogicalKeyboardKey.shiftLeft);
|
||||
await tester.sendKeyUpEvent(LogicalKeyboardKey.altLeft);
|
||||
await tester.sendKeyUpEvent(LogicalKeyboardKey.controlLeft);
|
||||
}
|
||||
|
||||
void main() {
|
||||
test('adjacency follows nested splits and stops at outer edges', () {
|
||||
final controller = _nested();
|
||||
addTearDown(controller.dispose);
|
||||
expect(_targets(controller, 'a'), {
|
||||
ChatPaneDirection.up: null,
|
||||
ChatPaneDirection.down: null,
|
||||
ChatPaneDirection.left: null,
|
||||
// b and c share a's right edge equally and a's centre line falls in
|
||||
// their divider: the tie goes to the first in reading order.
|
||||
ChatPaneDirection.right: 'b',
|
||||
});
|
||||
expect(_targets(controller, 'b'), {
|
||||
ChatPaneDirection.up: null,
|
||||
ChatPaneDirection.down: 'c',
|
||||
ChatPaneDirection.left: 'a',
|
||||
ChatPaneDirection.right: null,
|
||||
});
|
||||
// Once d is wider it spans b's centre line, so b's move down takes d.
|
||||
final bottom =
|
||||
((controller.root as ChatWorkspaceSplit).second as ChatWorkspaceSplit)
|
||||
.second
|
||||
as ChatWorkspaceSplit;
|
||||
controller.resize(bottom.id, .3);
|
||||
expect(_targets(controller, 'b')[ChatPaneDirection.down], 'd');
|
||||
controller.resize(bottom.id, .5);
|
||||
expect(_targets(controller, 'c'), {
|
||||
ChatPaneDirection.up: 'b',
|
||||
ChatPaneDirection.down: null,
|
||||
ChatPaneDirection.left: 'a',
|
||||
ChatPaneDirection.right: 'd',
|
||||
});
|
||||
expect(_targets(controller, 'd')[ChatPaneDirection.left], 'c');
|
||||
expect(_targets(controller, 'd')[ChatPaneDirection.up], 'b');
|
||||
});
|
||||
|
||||
test('swap trades places both ways, keeping ids, ratios and focus', () {
|
||||
final controller = _nested();
|
||||
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 serial = controller.moveSerial;
|
||||
controller.swap(ids['a']!, ids['c']!);
|
||||
expect(controller.panes.map((p) => p.sessionId), ['c', 'b', 'a', 'd']);
|
||||
expect({for (final p in controller.panes) p.sessionId: p.id}, ids);
|
||||
expect(controller.activePaneId, ids['a']);
|
||||
expect(controller.moveSerial, serial + 1);
|
||||
expect(controller.movedPaneIds, {ids['a'], ids['c']});
|
||||
expect((controller.root as ChatWorkspaceSplit).ratio, .3);
|
||||
expect((controller.root as ChatWorkspaceSplit).id, outer.id);
|
||||
controller.swap(ids['a']!, ids['c']!);
|
||||
expect(controller.panes.map((p) => p.sessionId), ['a', 'b', 'c', 'd']);
|
||||
controller.swap(ids['a']!, 'missing');
|
||||
controller.swap(ids['a']!, ids['a']!);
|
||||
expect(controller.moveSerial, serial + 2);
|
||||
});
|
||||
|
||||
test('a moved layout survives an encode/decode round trip', () {
|
||||
final controller = _nested();
|
||||
addTearDown(controller.dispose);
|
||||
controller.swap(_id(controller, 'b'), _id(controller, 'd'));
|
||||
final source = controller.snapshot(sidebarMode: 'compact')!.encode();
|
||||
final restored = ChatWorkspaceController();
|
||||
addTearDown(restored.dispose);
|
||||
expect(restored.restoreLayout(ChatWorkspaceSnapshot.decode(source)!), true);
|
||||
expect(restored.panes.map((p) => p.sessionId), ['a', 'd', 'c', 'b']);
|
||||
expect(restored.activePane?.sessionId, 'b');
|
||||
});
|
||||
|
||||
test('the move chord adds Alt to the focus chord, Command on macOS', () {
|
||||
expect(
|
||||
chatPaneMoveActivator(
|
||||
ChatPaneDirection.up,
|
||||
platform: TargetPlatform.macOS,
|
||||
).debugDescribeKeys(),
|
||||
'Alt + Meta + Shift + Arrow Up',
|
||||
);
|
||||
expect(
|
||||
chatPaneMoveActivator(
|
||||
ChatPaneDirection.down,
|
||||
platform: TargetPlatform.windows,
|
||||
).debugDescribeKeys(),
|
||||
'Control + Alt + Shift + Arrow Down',
|
||||
);
|
||||
});
|
||||
|
||||
test('the chord family: Alt turns focusing into moving', () {
|
||||
// Only real key events reach the handler; the parse is checked through
|
||||
// the widget tests below. Here, the menu's chord and the handler agree.
|
||||
final activator = chatPaneMoveActivator(
|
||||
ChatPaneDirection.left,
|
||||
platform: TargetPlatform.linux,
|
||||
);
|
||||
expect(activator.trigger, LogicalKeyboardKey.arrowLeft);
|
||||
expect(
|
||||
[activator.control, activator.alt, activator.shift, activator.meta],
|
||||
[true, true, true, false],
|
||||
);
|
||||
});
|
||||
|
||||
testWidgets(
|
||||
'the chord moves the focused pane, keeps its draft, and is inert at edges',
|
||||
(tester) async {
|
||||
final controller = ChatWorkspaceController()
|
||||
..open('one')
|
||||
..splitActive('two', ChatSplitAxis.horizontal);
|
||||
addTearDown(controller.dispose);
|
||||
await tester.pumpWidget(_host(controller));
|
||||
final input = find.byKey(const ValueKey('input-one'));
|
||||
await tester.enterText(input, 'draft one');
|
||||
final state = tester.state(find.byKey(const ValueKey('one')));
|
||||
final before = tester.getRect(input);
|
||||
await _chord(tester, LogicalKeyboardKey.arrowRight);
|
||||
await tester.pump();
|
||||
await tester.pump(const Duration(milliseconds: 100));
|
||||
// Mid-glide: the retained view is between its old and new tiles.
|
||||
final middle = tester.getRect(input);
|
||||
await tester.pumpAndSettle();
|
||||
final after = tester.getRect(input);
|
||||
expect(middle.left, greaterThan(before.left));
|
||||
expect(after.left, greaterThan(middle.left));
|
||||
expect(tester.state(find.byKey(const ValueKey('one'))), same(state));
|
||||
expect(tester.widget<TextField>(input).controller!.text, 'draft one');
|
||||
expect(controller.activePane?.sessionId, 'one');
|
||||
expect(controller.panes.map((p) => p.sessionId), ['two', 'one']);
|
||||
final serial = controller.moveSerial;
|
||||
await _chord(tester, LogicalKeyboardKey.arrowRight);
|
||||
await _chord(tester, LogicalKeyboardKey.arrowUp);
|
||||
await tester.pumpAndSettle();
|
||||
expect(controller.moveSerial, serial);
|
||||
expect(tester.widget<TextField>(input).controller!.text, 'draft one');
|
||||
},
|
||||
variant: TargetPlatformVariant.only(TargetPlatform.linux),
|
||||
);
|
||||
|
||||
testWidgets('reduced motion swaps the panes instantly', (tester) async {
|
||||
final controller = ChatWorkspaceController()
|
||||
..open('one')
|
||||
..splitActive('two', ChatSplitAxis.horizontal);
|
||||
addTearDown(controller.dispose);
|
||||
await tester.pumpWidget(_host(controller, reduce: true));
|
||||
final input = find.byKey(const ValueKey('input-one'));
|
||||
final twoBefore = tester.getRect(find.byKey(const ValueKey('input-two')));
|
||||
controller.swap(_id(controller, 'one'), _id(controller, 'two'));
|
||||
await tester.pump();
|
||||
expect(tester.getRect(input).left, twoBefore.left);
|
||||
expect(tester.hasRunningAnimations, isFalse);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user