ultrawide layout test coverage + shared setSurfaceSize helper (T-241)

Add setSurfaceSize(tester, width) to the widget harness — the reusable way to
test width-sensitive layout at an ultrawide surface (a wide SizedBox under the
default 800px surface is clamped, so the view's physicalSize must be set), the
foundation T-241 asked for.

Ultrawide cases on the surfaces most prone to width-proportional bugs (the T-239
class): ClideMarquee stays static when a line fits a 3440 slot (it was only
tested narrow); the quick-open palette stays width-capped, not stretched edge to
edge. The status bar already covers 600+3440 (T-239).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-09 22:34:16 +02:00
co-authored by Claude Opus 4.8
parent 7d8f58690f
commit 1411e19ab4
5 changed files with 58 additions and 0 deletions
+14
View File
@@ -89,3 +89,17 @@ Future<void> pumpAsync(WidgetTester tester) async {
await tester.pump();
await tester.pump(const Duration(milliseconds: 20));
}
/// Size the test surface to [width]×[height] for width-sensitive layout checks
/// (T-241). A wide SizedBox under the default 800px surface is CLAMPED, so the
/// view's physicalSize must be set directly. Auto-resets after the test. Pass an
/// ultrawide width (e.g. 3440) alongside a normal one to catch width-PROPORTIONAL
/// bugs that hide at 800px (the T-239 class of bug).
void setSurfaceSize(WidgetTester tester, double width, {double height = 800}) {
tester.view.physicalSize = Size(width, height);
tester.view.devicePixelRatio = 1.0;
addTearDown(() {
tester.view.resetPhysicalSize();
tester.view.resetDevicePixelRatio();
});
}
+11
View File
@@ -163,4 +163,15 @@ void main() {
await pumpAsync(tester);
expect(find.text('No matching files'), findsOneWidget);
});
testWidgets('the palette is width-capped (not stretched) on an ultrawide surface (T-241)', (tester) async {
setSurfaceSize(tester, 3440);
await tester.pumpWidget(harness(f, const QuickOpenOverlay()));
f.services.quickOpen.open();
await pumpAsync(tester);
// The panel is a fixed 480 — the filter field must stay capped, not span the
// full 3440 (a Row/Expanded regression would stretch it edge to edge).
final field = tester.getRect(find.byType(EditableText));
expect(field.width, lessThan(600), reason: 'capped to the panel, not stretched across the ultrawide surface');
});
}
+15
View File
@@ -6,6 +6,8 @@ import 'package:clide/widgets/widgets.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';
import '../../helpers/widget_harness.dart';
Widget _boxed(double width, Widget child) => Directionality(
textDirection: TextDirection.ltr,
child: Center(
@@ -35,6 +37,19 @@ void main() {
await tester.pumpWidget(const SizedBox()); // dispose → stop ticker
});
testWidgets('a line that fits an ultrawide slot stays static, no scroll/overflow (T-241)', (tester) async {
// The slot must really be 3440 wide — a SizedBox(3440) under the default
// 800px surface would be clamped, so size the view first.
setSurfaceSize(tester, 3440, height: 200);
await tester.pumpWidget(_boxed(3440, const ClideMarquee(child: Text('a normal-length status line'))));
await tester.pump();
await tester.pump(const Duration(milliseconds: 100)); // would advance a ticker if one started
// Fits the wide slot → a single static copy (not the looped duplicate), no overflow.
expect(find.text('a normal-length status line'), findsOneWidget);
expect(tester.takeException(), isNull);
await tester.pumpWidget(const SizedBox());
});
testWidgets('reduced motion (disableAnimations) does not scroll; pumpAndSettle completes (T-284)', (tester) async {
await tester.pumpWidget(_reducedMotion(40, const ClideMarquee(child: Text('a long status line that overflows the slot'))));
// The ticker must never start, so the frame queue is quiescent — if the