Raise the declared minimums in pubspec.yaml to what our deps already require: Flutter >=3.35.0 / Dart >=3.9.0 (was 3.19.0 / 3.5.0). alchemist 0.12 needs Flutter 3.32; Dart 3.9 first ships in Flutter 3.35, so 3.35 is the binding floor. Pin the exact build toolchain in .fvmrc (Flutter 3.44.1). Moving to the Dart 3.9 language level switches `dart format` to the new "tall" style and enables two new lints. This commit is the resulting mechanical churn, isolated from any behaviour change: - whole-tree `dart format` reformat (tall style) - `dart fix` for unnecessary_underscores + use_null_aware_elements No runtime behaviour change; `make test` green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
77 lines
3.3 KiB
Dart
77 lines
3.3 KiB
Dart
/// Regression test for the bottom status bar's right-group alignment (T-239):
|
|
/// within the center (workspace) bar, left items are start-aligned and the
|
|
/// right group (tool status / theme switcher) hugs the right edge — even with
|
|
/// a flex left item present, and at ANY bar width incl. ultrawide (where the
|
|
/// old Spacer-vs-flex layout drifted noticeably). Uses the REAL StatusbarHost
|
|
/// with real StatusItemContributions; the surface is sized per case via
|
|
/// tester.view so a wide SizedBox isn't clamped to the default 800px surface.
|
|
library;
|
|
|
|
import 'package:clide/app.dart';
|
|
import 'package:clide/extension/extension.dart';
|
|
import 'package:clide/kernel/kernel.dart';
|
|
import 'package:flutter/widgets.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
import 'helpers/kernel_fixture.dart';
|
|
|
|
Widget _bar(KernelFixture f, double width) => Directionality(
|
|
textDirection: TextDirection.ltr,
|
|
child: ClideKernel(
|
|
services: f.services,
|
|
child: ClideTheme(
|
|
controller: f.services.theme,
|
|
child: MediaQuery(
|
|
data: MediaQueryData(size: Size(width, 200)),
|
|
child: Align(
|
|
alignment: Alignment.topLeft,
|
|
child: SizedBox(width: width, height: 26, child: const StatusbarHost()),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
|
|
void main() {
|
|
late KernelFixture f;
|
|
setUp(() async => f = await KernelFixture.create());
|
|
tearDown(() async {
|
|
await f.dispose();
|
|
});
|
|
|
|
Future<void> pumpAt(WidgetTester tester, double width) async {
|
|
tester.view.physicalSize = Size(width, 200);
|
|
tester.view.devicePixelRatio = 1.0;
|
|
addTearDown(() {
|
|
tester.view.resetPhysicalSize();
|
|
tester.view.resetDevicePixelRatio();
|
|
});
|
|
await tester.pumpWidget(_bar(f, width));
|
|
await tester.pump();
|
|
}
|
|
|
|
testWidgets('right group hugs the bar right edge at normal AND ultrawide widths (T-239)', (tester) async {
|
|
// Mirrors the real surface: a left flex:1 item (like the Claude status
|
|
// marquee, priority 50) + a right-group item (priority >= 100).
|
|
f.services.panels.contribute(StatusItemContribution(id: 'test.left.flex', priority: 50, flex: 1, build: (_) => const Text('LEFT', softWrap: false)));
|
|
f.services.panels.contribute(StatusItemContribution(id: 'test.right', priority: 110, build: (_) => const Text('RIGHT', softWrap: false)));
|
|
|
|
// 600 = normal, 3440 = ultrawide (where the float actually surfaced).
|
|
for (final width in [600.0, 3440.0]) {
|
|
await pumpAt(tester, width);
|
|
expect(tester.takeException(), isNull, reason: 'width=$width');
|
|
// StatusbarHost pads 8px each side → right item's right edge ≈ width - 8.
|
|
// (Collapse toggles live at the bar's screen edges, outside this host.)
|
|
expect(tester.getTopRight(find.text('RIGHT')).dx, closeTo(width - 8, 1.0), reason: 'right group not at edge at width=$width');
|
|
expect(tester.getTopLeft(find.text('LEFT')).dx, closeTo(8, 1.0), reason: 'left not at start at width=$width');
|
|
}
|
|
});
|
|
|
|
testWidgets('right group hugs the edge with no left items (ultrawide)', (tester) async {
|
|
f.services.panels.contribute(StatusItemContribution(id: 'test.right.only', priority: 110, build: (_) => const Text('R2', softWrap: false)));
|
|
await pumpAt(tester, 3440.0);
|
|
expect(tester.takeException(), isNull);
|
|
expect(tester.getTopRight(find.text('R2')).dx, closeTo(3440 - 8, 1.0));
|
|
});
|
|
}
|