Files
pipelines/app/test/features/attention/runtime/attention_runs_layout_test.dart
T
alan 968e3e908a Remove Cupertino attention branches
Keep the reviewed attention surfaces on their Material implementations while preserving public cupertino parameters for remaining callers. Remove the unreachable Cupertino sheet and narrow tests to the Material path.
2026-11-11 01:31:14 +00:00

68 lines
2.2 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/attention/runtime/attention_store.dart';
import 'package:pipelines_app/features/attention/ui/needs_you_keys.dart';
import 'attention_runs_test_support.dart';
/// The hardest real-app case: a narrow phone at a doubled text scale. Both the
/// Runs list chrome and the sheet must keep the bell and every action inside the
/// viewport.
void main() {
testWidgets('Material fits the bell and sheet at 320 logical px and 2x', (
tester,
) async {
tester.view.devicePixelRatio = 2;
tester.view.physicalSize = const Size(640, 1280);
addTearDown(tester.view.resetPhysicalSize);
addTearDown(tester.view.resetDevicePixelRatio);
final gateway = AttentionRunsGateway();
addTearDown(gateway.framesController.close);
await mountAttentionRuns(
tester,
gateway,
store: MemoryAttentionStore(),
runs: [
attentionRun(
1,
'waiting',
title: 'Approve a release candidate at 320 px',
),
attentionRun(
2,
'failed',
title: 'A failed run with a label long enough to wrap',
diagnostic: 'Stage 3 stopped because the credential is missing.',
),
],
textScale: 2,
);
expect(find.byKey(attentionBellKey), findsOneWidget);
final listError = tester.takeException();
expect(
listError,
isNull,
reason: listError is FlutterError
? 'Material list: ${listError.toStringDeep()}'
: 'Material list: $listError',
);
await openAttentionSheet(tester);
final sheetError = tester.takeException();
expect(
sheetError,
isNull,
reason: sheetError is FlutterError
? 'Material sheet: ${sheetError.toStringDeep()}'
: 'Material sheet: $sheetError',
);
final sheet = tester.getRect(find.byKey(attentionSheetKey));
expect(sheet.left, greaterThanOrEqualTo(0));
expect(sheet.right, lessThanOrEqualTo(320));
expect(sheet.top, greaterThanOrEqualTo(0));
expect(sheet.bottom, lessThanOrEqualTo(640));
await tester.binding.handlePopRoute();
await tester.pumpAndSettle();
});
}