Merge branch 'main' into pipelines/run-20261111-0115-cupertino-out-ui-motion-navigation-input-6491

# Conflicts:
#	app/test/features/runs/ui/runs_list_widget_test.dart
This commit is contained in:
2026-11-11 02:43:51 +00:00
74 changed files with 1997 additions and 2915 deletions
@@ -0,0 +1,130 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/shell/windows/window_entry.dart';
import 'package:pipelines_app/shell/windows/window_kind.dart';
import 'package:pipelines_app/shell/windows/window_layer.dart';
import 'package:pipelines_app/shell/windows/window_manager.dart';
import 'window_test_harness.dart';
/// A probe kind whose content keeps its element when the window is retargeted,
/// so a rebuild is visible in the same state's counter.
class _StableProbeKind extends WindowKind {
@override
String get key => 'stable';
@override
bool get serverScoped => false;
@override
IconData get icon => Icons.science_outlined;
@override
String title(BuildContext context, WindowEntry entry) =>
'Probe ${entry.contentId}';
@override
Widget build(BuildContext context, WindowEntry entry) =>
ProbeContent(key: const ValueKey('stable-content'), id: entry.contentId);
}
void main() {
late WindowManager manager;
setUp(() => manager = probeManager());
Finder window(String title) => find.byWidgetPredicate(
(w) => w is WindowLayer && 'Probe ${w.entry.contentId}' == title,
);
Finder inWindow(String title, Finder what) =>
find.descendant(of: window(title), matching: what);
ProbeContentState content(WidgetTester tester, String id) =>
tester.state<ProbeContentState>(find.byKey(ValueKey('content-$id')));
Future<void> openTwo(WidgetTester tester) async {
manager.open('probe', 'a', frame: const Rect.fromLTWH(100, 80, 360, 420));
manager.open('probe', 'b', frame: const Rect.fromLTWH(600, 200, 360, 420));
await pumpProbe(tester, manager);
}
testWidgets('dragging a window moves it without rebuilding any content', (
tester,
) async {
await openTwo(tester);
final a = content(tester, 'a');
final b = content(tester, 'b');
final beforeA = a.builds;
final beforeB = b.builds;
final start = windowRect(tester, 'Probe a').topLeft;
final fieldStart = tester
.getRect(find.byKey(const ValueKey('a-field')))
.topLeft;
final gesture = await tester.startGesture(
tester.getCenter(
inWindow('Probe a', find.byKey(const ValueKey('window-title'))),
),
);
for (var i = 0; i < 8; i++) {
await gesture.moveBy(const Offset(12, 6));
await tester.pump();
expect(a.builds, beforeA, reason: 'dragged window rebuilt at move $i');
expect(b.builds, beforeB, reason: 'other window rebuilt at move $i');
}
await gesture.up();
await tester.pumpAndSettle();
// It really moved, and its content followed it.
expect(windowRect(tester, 'Probe a').topLeft, start + const Offset(96, 48));
expect(
tester.getRect(find.byKey(const ValueKey('a-field'))).topLeft,
fieldStart + const Offset(96, 48),
);
expect(content(tester, 'a').builds, beforeA);
expect(content(tester, 'b').builds, beforeB);
});
testWidgets('resizing a window keeps another window and sees the new size', (
tester,
) async {
await openTwo(tester);
final a = content(tester, 'a');
final b = content(tester, 'b');
final beforeA = a.builds;
final beforeB = b.builds;
final beforeSize = b.lastSize!;
final gesture = await tester.startGesture(
tester.getCenter(
inWindow('Probe b', find.byKey(const ValueKey('window-resize'))),
),
);
for (var i = 0; i < 5; i++) {
await gesture.moveBy(const Offset(-16, -10));
await tester.pump();
expect(a.builds, beforeA, reason: 'other window rebuilt at move $i');
}
await gesture.up();
await tester.pumpAndSettle();
expect(content(tester, 'a').builds, beforeA);
final state = content(tester, 'b');
expect(state.builds, greaterThan(beforeB));
expect(state.lastSize!.width, beforeSize.width - 80);
expect(state.lastSize!.height, beforeSize.height - 50);
});
testWidgets('content still rebuilds when its window is retargeted', (
tester,
) async {
manager = WindowManager(
kinds: WindowKinds()..register(_StableProbeKind()),
);
final entry = manager.open('stable', 'a');
await pumpProbe(tester, manager);
final state = tester.state<ProbeContentState>(
find.byKey(const ValueKey('stable-content')),
);
final before = state.builds;
manager.setContent(entry.id, 'c');
await tester.pumpAndSettle();
final after = tester.state<ProbeContentState>(
find.byKey(const ValueKey('stable-content')),
);
expect(after, same(state));
expect(after.builds, greaterThan(before));
expect(after.widget.id, 'c');
expect(find.text('Probe c'), findsOneWidget);
});
}