Narrow chat tests to Material hosts

Remove Cupertino-only fixtures, test variants, and the obsolete readable-text test now that the app is Material-only. Preserve the Material coverage while avoiding unreachable platform branches.
This commit is contained in:
2026-11-11 12:35:38 +00:00
parent fc1e93760d
commit 8f52c7ec55
10 changed files with 452 additions and 753 deletions
@@ -128,76 +128,70 @@ void main() {
expect(tester.takeException(), isNull);
});
for (final cupertino in [false, true]) {
final host = cupertino ? 'Cupertino' : 'Material';
testWidgets(
'Material narrow header keeps native back/title and compact model icon',
(tester) async {
_useNarrowText(tester);
final semantics = tester.ensureSemantics();
final gateway = FakeChatGateway();
addTearDown(gateway.close);
gateway.history = (_) async => chatPage(const []);
gateway.subscribe = () async => const {};
var backed = 0;
testWidgets(
'$host narrow header keeps native back/title and compact model icon',
(tester) async {
_useNarrowText(tester);
final semantics = tester.ensureSemantics();
final gateway = FakeChatGateway();
addTearDown(gateway.close);
gateway.history = (_) async => chatPage(const []);
gateway.subscribe = () async => const {};
var backed = 0;
await tester.pumpWidget(
_host(
ChatThreadView(
gateway: gateway,
sessionId: 's',
title: _title,
session: _session,
onBack: () => backed++,
),
cupertino: cupertino,
await tester.pumpWidget(
_host(
ChatThreadView(
gateway: gateway,
sessionId: 's',
title: _title,
session: _session,
onBack: () => backed++,
),
);
await tester.pumpAndSettle();
cupertino: false,
),
);
await tester.pumpAndSettle();
final title = find.text(_title);
final model = find.byKey(const Key('chat-model'));
final info = find.byKey(const Key('chat-info'));
final back = find.byKey(const Key('chat-back'));
expect(title, findsOneWidget);
expect(model, findsOneWidget);
expect(info, findsOneWidget);
expect(back, findsOneWidget);
expect(tester.takeException(), isNull);
// Back is the platform's own control, as on every other page.
expect(
find.descendant(of: back, matching: findNativeBack()),
findsOneWidget,
);
final title = find.text(_title);
final model = find.byKey(const Key('chat-model'));
final info = find.byKey(const Key('chat-info'));
final back = find.byKey(const Key('chat-back'));
expect(title, findsOneWidget);
expect(model, findsOneWidget);
expect(info, findsOneWidget);
expect(back, findsOneWidget);
expect(tester.takeException(), isNull);
// Back is the platform's own control, as on every other page.
expect(
find.descendant(of: back, matching: findNativeBack()),
findsOneWidget,
);
// One floating row of separate pieces: the round Back, the title pill
// (which is the information control and holds the title), then the
// selector island in the trailing row.
double centerY(Finder finder) => tester.getCenter(finder).dy;
expect((centerY(back) - centerY(info)).abs(), lessThan(16));
expect((centerY(model) - centerY(info)).abs(), lessThan(16));
expect(find.descendant(of: info, matching: title), findsOneWidget);
double right(Finder finder) => tester.getTopRight(finder).dx;
expect(right(back), lessThanOrEqualTo(tester.getTopLeft(info).dx));
expect(find.byIcon(Icons.memory_outlined), findsOneWidget);
if (!cupertino) {
final semantics = tester.getSemantics(model);
expect(semantics.label, contains('Change model'));
expect(semantics.label, contains('currently'));
}
expect(
find.textContaining('an-extremely-long-recorded-model-id'),
findsNothing,
);
// One floating row of separate pieces: the round Back, the title pill
// (which is the information control and holds the title), then the
// selector island in the trailing row.
double centerY(Finder finder) => tester.getCenter(finder).dy;
expect((centerY(back) - centerY(info)).abs(), lessThan(16));
expect((centerY(model) - centerY(info)).abs(), lessThan(16));
expect(find.descendant(of: info, matching: title), findsOneWidget);
double right(Finder finder) => tester.getTopRight(finder).dx;
expect(right(back), lessThanOrEqualTo(tester.getTopLeft(info).dx));
expect(find.byIcon(Icons.memory_outlined), findsOneWidget);
final modelSemantics = tester.getSemantics(model);
expect(modelSemantics.label, contains('Change model'));
expect(modelSemantics.label, contains('currently'));
expect(
find.textContaining('an-extremely-long-recorded-model-id'),
findsNothing,
);
await tester.tap(back);
await tester.pump();
expect(backed, 1);
semantics.dispose();
},
);
}
await tester.tap(back);
await tester.pump();
expect(backed, 1);
semantics.dispose();
},
);
// The mode control is Material only.
for (final cupertino in [false]) {