Files
pipelines/app/test/shell/windows/window_test_harness.dart
T
alan a99f7014f5 Add the shell window host with layering acceptance tests
Phase 1.3 and 1.4 of docs/plans/floating-windows.md. Windows are plain
children of the terminal stage's stack in the shell page, outside every
destination, so popups opened from one are above all of them. Each window
has its own page navigator: pushed pages open inside the window, and popup
routes go to the root navigator. One WindowFrame chrome (move, resize,
minimise, maximise, close), a focus scope per window, a ScaffoldMessenger
per window.

No feature uses it yet. The capture fixture opens probe windows with
?windows=N, and window_layering_test.dart covers every popup type from a
window over Chat and over another destination.
2026-11-10 20:48:31 +00:00

80 lines
2.4 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/shell/windows/window_frame.dart';
import 'package:pipelines_app/shell/windows/window_host.dart';
import 'package:pipelines_app/shell/windows/window_manager.dart';
import 'package:pipelines_app/ui/motion/fade_through_stack.dart';
export '../../../tool/capture/window_probe.dart';
/// The shell in miniature: a root navigator whose one page holds two
/// destinations (only one shown, as in the app) and the window host above
/// them.
class ProbeApp extends StatelessWidget {
const ProbeApp({
super.key,
required this.manager,
this.destination = 0,
this.boundary,
});
final WindowManager manager;
final int destination;
final GlobalKey? boundary;
@override
Widget build(BuildContext context) => RepaintBoundary(
key: boundary,
child: MaterialApp(
home: Scaffold(
body: Stack(
fit: StackFit.expand,
children: [
FadeThroughStack(
index: destination,
children: [
Center(
child: TextField(
key: const ValueKey('chat-composer'),
decoration: const InputDecoration(hintText: 'Chat'),
),
),
Align(
alignment: Alignment.bottomRight,
child: TextButton(
key: const ValueKey('runs-button'),
onPressed: () {},
child: const Text('Runs content'),
),
),
],
),
Positioned.fill(child: WindowHost(manager: manager)),
],
),
),
),
);
}
/// Pumps a 1280x800 app with [manager]'s windows.
Future<void> pumpProbe(
WidgetTester tester,
WindowManager manager, {
int destination = 0,
GlobalKey? boundary,
}) async {
tester.view.physicalSize = const Size(1280, 800);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
await tester.pumpWidget(
ProbeApp(manager: manager, destination: destination, boundary: boundary),
);
await tester.pumpAndSettle();
}
/// The window's card (title bar and body) in global coordinates.
Rect windowRect(WidgetTester tester, String title) => tester.getRect(
find.ancestor(of: find.text(title), matching: find.byType(WindowFrame)),
);