Merge commit 'a6d1492ad8bb88d78bf710f88dc10fa367e1dd7a' into pipelines/run-20261112-0053-ctrl-tab-cycles-floating-chat-windows-4658
This commit is contained in:
@@ -3,6 +3,7 @@ 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_edges.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';
|
||||
@@ -82,7 +83,10 @@ Widget host(
|
||||
List<KeyEvent>? fieldKeys,
|
||||
bool actionBars = false,
|
||||
bool filesProbe = false,
|
||||
ThemeMode themeMode = ThemeMode.light,
|
||||
}) => MaterialApp(
|
||||
themeMode: themeMode,
|
||||
darkTheme: ThemeData.dark(),
|
||||
home: MediaQuery(
|
||||
data: MediaQueryData(disableAnimations: reduceMotion),
|
||||
child: Scaffold(
|
||||
@@ -410,6 +414,71 @@ void main() {
|
||||
},
|
||||
);
|
||||
|
||||
test(
|
||||
'the stage edges sit in the gaps beside the stage, or on the workspace edge',
|
||||
() {
|
||||
final (left, right) = chatCenterStageEdgeRects(
|
||||
const Rect.fromLTWH(418, 0, 950, 800),
|
||||
const Size(1368, 800),
|
||||
);
|
||||
expect(left, const Rect.fromLTWH(411.5, 0, 1, 800));
|
||||
expect(right, const Rect.fromLTWH(1367, 0, 1, 800));
|
||||
|
||||
// A stage that reaches the workspace's right edge keeps its hairline inside.
|
||||
final (edgeLeft, edgeRight) = chatCenterStageEdgeRects(
|
||||
const Rect.fromLTWH(650, 0, 950, 800),
|
||||
const Size(1600, 800),
|
||||
);
|
||||
expect(edgeLeft, const Rect.fromLTWH(643.5, 0, 1, 800));
|
||||
expect(edgeRight, const Rect.fromLTWH(1599, 0, 1, 800));
|
||||
},
|
||||
);
|
||||
|
||||
for (final mode in [ThemeMode.light, ThemeMode.dark]) {
|
||||
testWidgets(
|
||||
'center stage draws the column edges in the ${mode.name} theme, only on stage',
|
||||
(tester) async {
|
||||
wide(tester);
|
||||
final workspace = threePanes();
|
||||
final stage = ChatCenterStageController(store: _MemoryStore());
|
||||
addTearDown(workspace.dispose);
|
||||
addTearDown(stage.dispose);
|
||||
await tester.pumpWidget(host(workspace, stage, themeMode: mode));
|
||||
await tester.pumpAndSettle();
|
||||
const leftKey = ValueKey('chat-center-stage-edge-left');
|
||||
const rightKey = ValueKey('chat-center-stage-edge-right');
|
||||
expect(find.byKey(leftKey), findsNothing);
|
||||
expect(find.byKey(rightKey), findsNothing);
|
||||
|
||||
stage.value = true;
|
||||
await tester.pumpAndSettle();
|
||||
final outline = Theme.of(
|
||||
tester.element(find.byType(ChatWorkspace)),
|
||||
).colorScheme.outlineVariant;
|
||||
for (final key in [leftKey, rightKey]) {
|
||||
expect(
|
||||
tester
|
||||
.widget<ColoredBox>(
|
||||
find.descendant(
|
||||
of: find.byKey(key),
|
||||
matching: find.byType(ColoredBox),
|
||||
),
|
||||
)
|
||||
.color,
|
||||
outline,
|
||||
);
|
||||
}
|
||||
// The hairlines frame the stage; the reading width is unchanged.
|
||||
expect(widthOf(tester, 'three'), 950);
|
||||
|
||||
stage.value = false;
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byKey(leftKey), findsNothing);
|
||||
expect(find.byKey(rightKey), findsNothing);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('reduced motion stages at once', (tester) async {
|
||||
wide(tester);
|
||||
final workspace = threePanes();
|
||||
|
||||
Reference in New Issue
Block a user