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
@@ -1,6 +1,5 @@
import 'dart:async';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/core/api_gateway.dart';
@@ -64,14 +63,8 @@ Widget materialHost(Widget child) => MaterialApp(
home: Scaffold(body: child),
);
Widget cupertinoHost(Widget child) => CupertinoApp(
theme: const CupertinoThemeData(brightness: Brightness.dark),
home: CupertinoPageScaffold(child: child),
);
Widget composerThread(
ComposerBarGateway gateway, {
bool cupertino = false,
int syncToken = 0,
ChatDraftStore? drafts,
String Function()? newOperationId,
@@ -87,7 +80,7 @@ Widget composerThread(
drafts: drafts ?? MemoryChatDraftStore(),
newOperationId: newOperationId,
);
return cupertino ? cupertinoHost(thread) : materialHost(thread);
return materialHost(thread);
}
/// The common fixture turn, so a rebuild has real transcript content to move.
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/chat/conversation/chat_composer_bar.dart';
@@ -6,31 +5,6 @@ import 'package:pipelines_app/features/chat/conversation/chat_composer_bar.dart'
import 'chat_composer_bar_fixtures.dart';
void main() {
testWidgets('an empty Cupertino composer holds its whole placeholder at '
'320px with 2x text', (tester) async {
tester.view.physicalSize = const Size(640, 1400);
tester.view.devicePixelRatio = 2;
tester.platformDispatcher.textScaleFactorTestValue = 2;
addTearDown(tester.view.resetPhysicalSize);
addTearDown(tester.view.resetDevicePixelRatio);
addTearDown(tester.platformDispatcher.clearTextScaleFactorTestValue);
final gateway = ComposerBarGateway();
addTearDown(gateway.close);
await tester.pumpWidget(composerThread(gateway, cupertino: true));
await tester.pumpAndSettle();
final field = tester.getRect(find.byType(CupertinoTextField));
final placeholder = find.text(chatComposerPlaceholder);
final rect = tester.getRect(placeholder);
expect(rect.bottom, lessThanOrEqualTo(field.bottom));
// Longer than three lines it ends in an ellipsis, never a clipped line.
final paragraph = tester.renderObject<RenderParagraph>(placeholder);
if (paragraph.didExceedMaxLines) {
expect(paragraph.overflow, TextOverflow.ellipsis);
}
});
test('the placeholder names the chat\'s folder when it has one', () {
expect(chatComposerPlaceholderFor('/Users/ada/repos/tank'), 'Work on tank');
expect(
@@ -42,35 +16,33 @@ void main() {
expect(chatComposerPlaceholderFor('/'), chatComposerPlaceholder);
});
for (final cupertino in [false, true]) {
testWidgets('the composer is one pill holding attach, field and Send '
'(${cupertino ? 'cupertino' : 'material'})', (tester) async {
final gateway = ComposerBarGateway();
addTearDown(gateway.close);
await tester.pumpWidget(
composerThread(
gateway,
cupertino: cupertino,
session: const {'id': 's', 'directory': '/Users/ada/repos/tank'},
),
);
await tester.pumpAndSettle();
testWidgets('the composer is one pill holding attach, field and Send', (
tester,
) async {
final gateway = ComposerBarGateway();
addTearDown(gateway.close);
await tester.pumpWidget(
composerThread(
gateway,
session: const {'id': 's', 'directory': '/Users/ada/repos/tank'},
),
);
await tester.pumpAndSettle();
final pill = find.byKey(const Key('chat-composer-pill'));
for (final key in [
'chat-composer-attach',
'chat-composer-field',
'chat-composer-primary',
]) {
expect(
find.descendant(of: pill, matching: find.byKey(Key(key))),
findsOneWidget,
);
}
final pill = find.byKey(const Key('chat-composer-pill'));
for (final key in [
'chat-composer-attach',
'chat-composer-field',
'chat-composer-primary',
]) {
expect(
find.descendant(of: pill, matching: find.text('Work on tank')),
find.descendant(of: pill, matching: find.byKey(Key(key))),
findsOneWidget,
);
});
}
}
expect(
find.descendant(of: pill, matching: find.text('Work on tank')),
findsOneWidget,
);
});
}
@@ -1,83 +0,0 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/chat/conversation/chat_thread_view.dart';
import 'package:pipelines_app/ui/adaptive/glass_pill.dart';
import 'package:pipelines_app/ui/adaptive/glass_surface.dart';
import 'chat_composer_bar_fixtures.dart';
// Contrast uses the rendered/composited foreground, not the RGB of an alpha
// system color as though it were opaque. These assertions cover only these
// named text states/surfaces, not the whole app or every possible backdrop.
double _contrast(Color foreground, Color background) {
final ink = Color.alphaBlend(foreground, background).computeLuminance();
final paper = background.computeLuminance();
return (ink > paper ? ink + .05 : paper + .05) /
(ink > paper ? paper + .05 : ink + .05);
}
void main() {
for (final brightness in Brightness.values) {
testWidgets(
'contextual placeholder stays readable on the glass fill $brightness',
(tester) async {
final gateway = ComposerBarGateway();
addTearDown(gateway.close);
await tester.pumpWidget(
CupertinoApp(
theme: CupertinoThemeData(brightness: brightness),
home: CupertinoPageScaffold(
child: ChatThreadView(
gateway: gateway,
sessionId: 's',
onBack: () {},
),
),
),
);
await tester.pumpAndSettle();
final field = tester.widget<CupertinoTextField>(
find.byType(CupertinoTextField),
);
final context = tester.element(find.byType(CupertinoTextField));
final base = CupertinoColors.systemGrey5.resolveFrom(context);
final backdrop = CupertinoTheme.of(context).scaffoldBackgroundColor;
final glass = Color.alphaBlend(
base.withValues(alpha: GlassPill.fillOpacity),
backdrop,
);
final highlighted = Color.alphaBlend(
GlassLook.forFill(base).highlight,
glass,
);
final foreground = CupertinoDynamicColor.resolve(
field.placeholderStyle!.color!,
context,
);
// White/black backdrop bounds also cover arbitrary blurred content
// below the 82% native fill. High-contrast mode uses solid base.
final backdropBounds = [
const Color(0xFF000000),
const Color(0xFFFFFFFF),
];
final boundedFills = [
for (final background in backdropBounds)
Color.alphaBlend(
base.withValues(alpha: GlassPill.fillOpacity),
background,
),
];
for (final fill in [base, glass, highlighted, ...boundedFills]) {
expect(_contrast(foreground, fill), greaterThanOrEqualTo(4.5));
}
debugPrint(
'contrast $brightness placeholder=${_contrast(foreground, glass).toStringAsFixed(2)} oldPlaceholder=${_contrast(CupertinoColors.placeholderText.resolveFrom(context), glass).toStringAsFixed(2)} glass=${glass.toARGB32().toRadixString(16)}',
);
expect(
field.placeholderStyle!.color,
CupertinoColors.label.resolveFrom(context),
);
expect(tester.takeException(), isNull);
},
);
}
}
@@ -1,6 +1,5 @@
import 'dart:async';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/core/api_gateway.dart';
@@ -43,7 +42,6 @@ Future<void> _host(
WidgetTester tester,
_Gateway gateway,
MemoryChatDraftStore drafts, {
bool cupertino = false,
int generation = 0,
}) async {
var sequence = 0;
@@ -55,11 +53,7 @@ Future<void> _host(
drafts: drafts,
newOperationId: () => 'op-$generation-${++sequence}',
);
await tester.pumpWidget(
cupertino
? CupertinoApp(home: CupertinoPageScaffold(child: thread))
: MaterialApp(home: Scaffold(body: thread)),
);
await tester.pumpWidget(MaterialApp(home: Scaffold(body: thread)));
await _pump(tester);
}
@@ -73,111 +67,94 @@ Future<void> _send(WidgetTester tester, String text) async {
Finder _state(String name) => find.byKey(Key('chat-delivery-$name'));
void main() {
for (final cupertino in [false, true]) {
testWidgets('send shows Sending… then Sent ($cupertino)', (tester) async {
final gateway = _Gateway();
addTearDown(gateway.close);
await _host(
tester,
gateway,
MemoryChatDraftStore(),
cupertino: cupertino,
);
testWidgets('send shows Sending… then Sent', (tester) async {
final gateway = _Gateway();
addTearDown(gateway.close);
await _host(tester, gateway, MemoryChatDraftStore());
await _send(tester, 'Hello');
expect(_state('sending'), findsOneWidget);
expect(find.text('Sending…'), findsOneWidget);
await _send(tester, 'Hello');
expect(_state('sending'), findsOneWidget);
expect(find.text('Sending…'), findsOneWidget);
gateway.prompts.single.complete({});
await _pump(tester);
expect(_state('sending'), findsNothing);
expect(_state('sent'), findsOneWidget);
gateway.prompts.single.complete({});
await _pump(tester);
expect(_state('sending'), findsNothing);
expect(_state('sent'), findsOneWidget);
// Only the newest accepted message keeps its quiet check.
await _send(tester, 'Again');
gateway.prompts.last.complete({});
await _pump(tester);
expect(_state('sent'), findsOneWidget);
});
// Only the newest accepted message keeps its quiet check.
await _send(tester, 'Again');
gateway.prompts.last.complete({});
await _pump(tester);
expect(_state('sent'), findsOneWidget);
});
testWidgets('a steered reply is distinct from Sent ($cupertino)', (
tester,
) async {
final gateway = _Gateway();
addTearDown(gateway.close);
await _host(
tester,
gateway,
MemoryChatDraftStore(),
cupertino: cupertino,
);
await _send(tester, 'Handle this in the running reply');
gateway.prompts.single.complete({'chat_steered': true});
await _pump(tester);
expect(_state('steered'), findsOneWidget);
expect(find.text('Delivered to the running reply'), findsOneWidget);
expect(_state('sent'), findsNothing);
await _send(tester, 'And this one too');
gateway.prompts.last.complete({'chat_steered': true});
await _pump(tester);
expect(_state('steered'), findsOneWidget);
});
testWidgets('a steered reply is distinct from Sent', (tester) async {
final gateway = _Gateway();
addTearDown(gateway.close);
await _host(tester, gateway, MemoryChatDraftStore());
await _send(tester, 'Handle this in the running reply');
gateway.prompts.single.complete({'chat_steered': true});
await _pump(tester);
expect(_state('steered'), findsOneWidget);
expect(find.text('Delivered to the running reply'), findsOneWidget);
expect(_state('sent'), findsNothing);
await _send(tester, 'And this one too');
gateway.prompts.last.complete({'chat_steered': true});
await _pump(tester);
expect(_state('steered'), findsOneWidget);
});
testWidgets('a queued reply shows Queued until the turn moves on '
'($cupertino)', (tester) async {
final gateway = _Gateway();
addTearDown(gateway.close);
await _host(
tester,
gateway,
MemoryChatDraftStore(),
cupertino: cupertino,
);
testWidgets('a queued reply shows Queued until the turn moves on ', (
tester,
) async {
final gateway = _Gateway();
addTearDown(gateway.close);
await _host(tester, gateway, MemoryChatDraftStore());
await _send(tester, 'Later please');
gateway.prompts.single.complete({'chat_queued': true});
await _pump(tester);
expect(_state('queued'), findsOneWidget);
expect(find.text('Queued'), findsOneWidget);
await _send(tester, 'Later please');
gateway.prompts.single.complete({'chat_queued': true});
await _pump(tester);
expect(_state('queued'), findsOneWidget);
expect(find.text('Queued'), findsOneWidget);
gateway.emitEvent(chatStepFrame('running'));
await _pump(tester);
expect(_state('queued'), findsNothing);
expect(_state('sent'), findsOneWidget);
});
gateway.emitEvent(chatStepFrame('running'));
await _pump(tester);
expect(_state('queued'), findsNothing);
expect(_state('sent'), findsOneWidget);
});
testWidgets('a refusal shows Not sent and Retry reuses the operation id '
'($cupertino)', (tester) async {
final gateway = _Gateway();
addTearDown(gateway.close);
final drafts = MemoryChatDraftStore();
await _host(tester, gateway, drafts, cupertino: cupertino);
testWidgets('a refusal shows Not sent and Retry reuses the operation id', (
tester,
) async {
final gateway = _Gateway();
addTearDown(gateway.close);
final drafts = MemoryChatDraftStore();
await _host(tester, gateway, drafts);
await _send(tester, 'Please refuse');
gateway.prompts.single.completeError(StateError('refused'));
await _pump(tester);
expect(_state('failed'), findsOneWidget);
expect(find.text('Not sent'), findsOneWidget);
// The text is back in the composer, so the bubble offers Retry only.
expect(find.byKey(const Key('chat-delivery-edit')), findsNothing);
expect(drafts.entries['s'], 'Please refuse');
await _send(tester, 'Please refuse');
gateway.prompts.single.completeError(StateError('refused'));
await _pump(tester);
expect(_state('failed'), findsOneWidget);
expect(find.text('Not sent'), findsOneWidget);
// The text is back in the composer, so the bubble offers Retry only.
expect(find.byKey(const Key('chat-delivery-edit')), findsNothing);
expect(drafts.entries['s'], 'Please refuse');
await tester.tap(find.byKey(const Key('chat-delivery-retry')));
await _pump(tester);
expect(_state('sending'), findsOneWidget);
expect(_state('failed'), findsNothing);
expect(gateway.promptBodies.map((body) => body['operation_id']), [
'op-0-1',
'op-0-1',
]);
await tester.tap(find.byKey(const Key('chat-delivery-retry')));
await _pump(tester);
expect(_state('sending'), findsOneWidget);
expect(_state('failed'), findsNothing);
expect(gateway.promptBodies.map((body) => body['operation_id']), [
'op-0-1',
'op-0-1',
]);
gateway.prompts.last.complete({});
await _pump(tester);
expect(_state('sent'), findsOneWidget);
expect(drafts.entries, isEmpty);
expect(drafts.unsentEntries, isEmpty);
});
}
gateway.prompts.last.complete({});
await _pump(tester);
expect(_state('sent'), findsOneWidget);
expect(drafts.entries, isEmpty);
expect(drafts.unsentEntries, isEmpty);
});
testWidgets('a message in flight at reload comes back as Not sent with '
'Retry and Edit', (tester) async {
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/chat/conversation/chat_thread_view.dart';
@@ -27,7 +26,6 @@ Map<String, dynamic> _session({bool levels = true}) => {
Future<void> _pump(
WidgetTester tester, {
required bool cupertino,
required Map<String, dynamic> session,
}) async {
tester.view.physicalSize = const Size(1200, 800);
@@ -45,46 +43,34 @@ Future<void> _pump(
session: session,
onBack: () {},
);
await tester.pumpWidget(
cupertino
? CupertinoApp(home: CupertinoPageScaffold(child: view))
: MaterialApp(home: Scaffold(body: view)),
);
await tester.pumpWidget(MaterialApp(home: Scaffold(body: view)));
await tester.pumpAndSettle();
}
void main() {
for (final cupertino in [false, true]) {
final host = cupertino ? 'Cupertino' : 'Material';
testWidgets('$host header shows the level beside model and mode', (
tester,
) async {
await _pump(tester, cupertino: cupertino, session: _session());
final header = find.byKey(const Key('chat-thread-header'));
for (final key in ['chat-model', 'chat-mode', 'chat-effort']) {
expect(
find.descendant(of: header, matching: find.byKey(Key(key))),
findsOneWidget,
);
}
expect(find.text('Thinking: High'), findsOneWidget);
final mode = tester.getRect(find.byKey(const Key('chat-mode')));
final effort = tester.getRect(find.byKey(const Key('chat-effort')));
expect(effort.left, greaterThanOrEqualTo(mode.right));
expect((effort.center.dy - mode.center.dy).abs(), lessThan(2));
});
testWidgets('$host header has no thinking control without levels', (
tester,
) async {
await _pump(
tester,
cupertino: cupertino,
session: _session(levels: false),
testWidgets('Material header shows the level beside model and mode', (
tester,
) async {
await _pump(tester, session: _session());
final header = find.byKey(const Key('chat-thread-header'));
for (final key in ['chat-model', 'chat-mode', 'chat-effort']) {
expect(
find.descendant(of: header, matching: find.byKey(Key(key))),
findsOneWidget,
);
expect(find.byKey(const Key('chat-model')), findsOneWidget);
expect(find.byKey(const Key('chat-effort')), findsNothing);
});
}
}
expect(find.text('Thinking: High'), findsOneWidget);
final mode = tester.getRect(find.byKey(const Key('chat-mode')));
final effort = tester.getRect(find.byKey(const Key('chat-effort')));
expect(effort.left, greaterThanOrEqualTo(mode.right));
expect((effort.center.dy - mode.center.dy).abs(), lessThan(2));
});
testWidgets('Material header has no thinking control without levels', (
tester,
) async {
await _pump(tester, session: _session(levels: false));
expect(find.byKey(const Key('chat-model')), findsOneWidget);
expect(find.byKey(const Key('chat-effort')), findsNothing);
});
}
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_test/flutter_test.dart';
@@ -11,12 +10,10 @@ import 'chat_thread_fixtures.dart';
/// Floating composer, reading width and header controls of a conversation.
Widget _host(Widget child, {required bool cupertino}) => cupertino
? CupertinoApp(home: CupertinoPageScaffold(child: child))
: MaterialApp(
theme: ThemeData(platform: TargetPlatform.android),
home: Scaffold(body: child),
);
Widget _host(Widget child) => MaterialApp(
theme: ThemeData(platform: TargetPlatform.android),
home: Scaffold(body: child),
);
void _size(WidgetTester tester, Size size) {
tester.view.physicalSize = size;
@@ -38,7 +35,6 @@ List<Map<String, dynamic>> _messages(int count) => [
Future<FakeChatGateway> _pump(
WidgetTester tester, {
required bool cupertino,
int messages = 30,
Map<String, dynamic>? session,
}) async {
@@ -55,7 +51,6 @@ Future<FakeChatGateway> _pump(
session: session,
onBack: () {},
),
cupertino: cupertino,
),
);
await tester.pumpAndSettle();
@@ -64,215 +59,146 @@ Future<FakeChatGateway> _pump(
void main() {
// The mode control is Material only.
for (final cupertino in [false]) {
final host = cupertino ? 'Cupertino' : 'Material';
testWidgets('transcript viewport ends at the composer top', (tester) async {
_size(tester, const Size(560, 800));
await _pump(tester);
testWidgets('$host transcript viewport ends at the composer top', (
final pill = find.byKey(const Key('chat-composer-pill'));
expect(tester.widget(pill), isA<GlassPill>());
Rect list() => tester.getRect(find.byKey(const ValueKey('chat-thread-s')));
Rect composer() => tester.getRect(find.byKey(const Key('chat-composer')));
Rect header() =>
tester.getRect(find.byKey(const Key('chat-thread-header')));
// The transcript has its own viewport below the complete header.
expect(list().top, greaterThanOrEqualTo(header().bottom));
// Nothing renders behind the composer: the viewport stops at its top.
expect(list().bottom, composer().top);
expect(composer().bottom, lessThanOrEqualTo(800));
expect(tester.getRect(pill).top, greaterThanOrEqualTo(list().bottom));
// Following the end, the last message rests fully above the composer.
final last = find.text('Message number 29 of the transcript.');
expect(tester.getRect(last).bottom, lessThanOrEqualTo(composer().top));
// A multi-line draft grows the composer; the viewport shrinks with it
// and the newest message stays in view above it.
final oneLine = composer().top;
await tester.enterText(
find.byKey(const Key('chat-composer-field')),
List.generate(6, (index) => 'Draft line $index').join('\n'),
);
await tester.pumpAndSettle();
expect(composer().top, lessThan(oneLine));
expect(list().bottom, composer().top);
expect(tester.getRect(last).bottom, lessThanOrEqualTo(composer().top));
// Scrolling back up moves history down inside the shortened viewport.
final rested = tester.getRect(last).top;
await tester.drag(
find.byKey(const ValueKey('chat-thread-s')),
const Offset(0, 120),
);
await tester.pumpAndSettle();
if (last.evaluate().isNotEmpty) {
expect(tester.getRect(last).top, greaterThan(rested));
}
expect(list().bottom, composer().top);
expect(list().top, greaterThanOrEqualTo(header().bottom));
expect(tester.takeException(), isNull);
});
testWidgets('transcript and composer share a centred reading width', (
tester,
) async {
_size(tester, const Size(1200, 800));
await _pump(tester, messages: 4);
final pill = tester.getRect(find.byKey(const Key('chat-composer-pill')));
expect(pill.width, lessThanOrEqualTo(kChatReadingWidth));
expect(pill.center.dx, closeTo(600, 1));
final message = tester.getRect(
find.text('Message number 0 of the transcript.'),
);
final inset = chatReadingInset(1200);
expect(message.left, greaterThanOrEqualTo(inset));
expect(message.right, lessThanOrEqualTo(1200 - inset));
// The list itself still spans the window, so its margins scroll it.
expect(
tester.getRect(find.byKey(const ValueKey('chat-thread-s'))).width,
1200,
);
// Narrow, the column fills the width less the usual margins.
_size(tester, const Size(560, 800));
await tester.pumpAndSettle();
expect(
tester.getRect(find.byKey(const Key('chat-composer-pill'))).width,
560 - 32,
);
});
testWidgets('header draws no empty pill without model or mode', (
tester,
) async {
_size(tester, const Size(560, 800));
await _pump(
tester,
) async {
_size(tester, const Size(560, 800));
await _pump(tester, cupertino: cupertino);
messages: 1,
session: const {'id': 's', 'backend': 'pi', 'directory': '/srv'},
);
final header = find.byKey(const Key('chat-thread-header'));
expect(find.byKey(const Key('chat-mode')), findsNothing);
// The round Back, the title pill and the actions pill, which always
// carries the Files toggle, so it is never drawn empty.
expect(
find.descendant(of: header, matching: find.byType(SegmentedPill)),
findsNWidgets(3),
);
expect(
find.descendant(
of: header,
matching: find.bySemanticsIdentifier('chat-files-toggle'),
),
findsOneWidget,
);
});
final pill = find.byKey(const Key('chat-composer-pill'));
expect(tester.widget(pill), isA<GlassPill>());
Rect list() =>
tester.getRect(find.byKey(const ValueKey('chat-thread-s')));
Rect composer() => tester.getRect(find.byKey(const Key('chat-composer')));
Rect header() =>
tester.getRect(find.byKey(const Key('chat-thread-header')));
// The transcript has its own viewport below the complete header.
expect(list().top, greaterThanOrEqualTo(header().bottom));
// Nothing renders behind the composer: the viewport stops at its top.
expect(list().bottom, composer().top);
expect(composer().bottom, lessThanOrEqualTo(800));
expect(tester.getRect(pill).top, greaterThanOrEqualTo(list().bottom));
// Following the end, the last message rests fully above the composer.
final last = find.text('Message number 29 of the transcript.');
expect(tester.getRect(last).bottom, lessThanOrEqualTo(composer().top));
// A multi-line draft grows the composer; the viewport shrinks with it
// and the newest message stays in view above it.
final oneLine = composer().top;
await tester.enterText(
find.byKey(const Key('chat-composer-field')),
List.generate(6, (index) => 'Draft line $index').join('\n'),
);
await tester.pumpAndSettle();
expect(composer().top, lessThan(oneLine));
expect(list().bottom, composer().top);
expect(tester.getRect(last).bottom, lessThanOrEqualTo(composer().top));
// Scrolling back up moves history down inside the shortened viewport.
final rested = tester.getRect(last).top;
await tester.drag(
find.byKey(const ValueKey('chat-thread-s')),
const Offset(0, 120),
);
await tester.pumpAndSettle();
if (last.evaluate().isNotEmpty) {
expect(tester.getRect(last).top, greaterThan(rested));
}
expect(list().bottom, composer().top);
expect(list().top, greaterThanOrEqualTo(header().bottom));
expect(tester.takeException(), isNull);
});
testWidgets('$host transcript and composer share a centred reading width', (
testWidgets('header controls keep their natural width when wide', (
tester,
) async {
_size(tester, const Size(1200, 800));
await _pump(
tester,
) async {
_size(tester, const Size(1200, 800));
await _pump(tester, cupertino: cupertino, messages: 4);
final pill = tester.getRect(find.byKey(const Key('chat-composer-pill')));
expect(pill.width, lessThanOrEqualTo(kChatReadingWidth));
expect(pill.center.dx, closeTo(600, 1));
final message = tester.getRect(
find.text('Message number 0 of the transcript.'),
);
final inset = chatReadingInset(1200);
expect(message.left, greaterThanOrEqualTo(inset));
expect(message.right, lessThanOrEqualTo(1200 - inset));
// The list itself still spans the window, so its margins scroll it.
expect(
tester.getRect(find.byKey(const ValueKey('chat-thread-s'))).width,
1200,
);
// Narrow, the column fills the width less the usual margins.
_size(tester, const Size(560, 800));
await tester.pumpAndSettle();
expect(
tester.getRect(find.byKey(const Key('chat-composer-pill'))).width,
560 - 32,
);
});
testWidgets('$host header draws no empty pill without model or mode', (
tester,
) async {
_size(tester, const Size(560, 800));
await _pump(
tester,
cupertino: cupertino,
messages: 1,
session: const {'id': 's', 'backend': 'pi', 'directory': '/srv'},
);
final header = find.byKey(const Key('chat-thread-header'));
expect(find.byKey(const Key('chat-mode')), findsNothing);
// The round Back, the title pill and the actions pill, which always
// carries the Files toggle, so it is never drawn empty.
expect(
find.descendant(of: header, matching: find.byType(SegmentedPill)),
findsNWidgets(3),
);
expect(
find.descendant(
of: header,
matching: find.bySemanticsIdentifier('chat-files-toggle'),
),
findsOneWidget,
);
});
testWidgets('$host header controls keep their natural width when wide', (
tester,
) async {
_size(tester, const Size(1200, 800));
await _pump(
tester,
cupertino: cupertino,
messages: 1,
session: const {
'id': 's',
'backend': 'opencode',
'model': 'p/sonnet-4-5',
'mode': 'default',
'mode_name': 'Ask for permission',
},
);
final mode = find.byKey(const Key('chat-mode'));
final model = find.byKey(const Key('chat-model'));
expect(mode, findsOneWidget);
expect(model, findsOneWidget);
for (final control in [mode, model]) {
final texts = find.descendant(of: control, matching: find.byType(Text));
for (final element in texts.evaluate()) {
final paragraph = element.renderObject! as RenderParagraph;
expect(
paragraph.didExceedMaxLines,
isFalse,
reason: 'truncated at 1200',
);
}
}
// Neutral like the bar's other actions, not the primary tint.
if (!cupertino) {
final button = tester.widget<TextButton>(mode);
final theme = Theme.of(tester.element(mode));
expect(
button.style!.foregroundColor!.resolve({}),
theme.colorScheme.onSurfaceVariant,
);
} else {
final label = tester.widget<RichText>(
find.descendant(
of: mode,
matching: find.byWidgetPredicate(
(widget) =>
widget is RichText &&
widget.text.toPlainText() == 'Ask for permission',
),
),
);
expect(
label.text.style?.color,
CupertinoColors.label.resolveFrom(tester.element(mode)),
);
}
});
testWidgets(
'Cupertino narrow header exposes the current permission on its icon',
(tester) async {
if (!cupertino) return;
final semantics = tester.ensureSemantics();
_size(tester, const Size(560, 800));
await _pump(
tester,
cupertino: true,
messages: 1,
session: const {
'id': 's',
'backend': 'opencode',
'model': 'p/sonnet-4-5',
'mode': 'default',
'mode_name': 'Ask for permission',
},
);
final mode = find.byKey(const Key('chat-mode'));
expect(mode, findsOneWidget);
expect(
find.descendant(of: mode, matching: find.text('Ask for permission')),
findsNothing,
);
expect(
tester.getSemantics(mode).label,
contains('Change mode, currently Ask for permission'),
);
await tester.tap(mode);
await tester.pumpAndSettle();
expect(find.byKey(const Key('chat-mode-sheet')), findsOneWidget);
// The fixture has no chat_modes catalog, but the recorded session mode
// remains visible in the sheet.
expect(
find.byKey(const ValueKey('chat-mode-option-default')),
findsOneWidget,
);
expect(find.text('Ask for permission'), findsWidgets);
semantics.dispose();
messages: 1,
session: const {
'id': 's',
'backend': 'opencode',
'model': 'p/sonnet-4-5',
'mode': 'default',
'mode_name': 'Ask for permission',
},
);
}
final mode = find.byKey(const Key('chat-mode'));
final model = find.byKey(const Key('chat-model'));
expect(mode, findsOneWidget);
expect(model, findsOneWidget);
for (final control in [mode, model]) {
final texts = find.descendant(of: control, matching: find.byType(Text));
for (final element in texts.evaluate()) {
final paragraph = element.renderObject! as RenderParagraph;
expect(
paragraph.didExceedMaxLines,
isFalse,
reason: 'truncated at 1200',
);
}
}
// Neutral like the bar's other actions, not the primary tint.
final button = tester.widget<TextButton>(mode);
final theme = Theme.of(tester.element(mode));
expect(
button.style!.foregroundColor!.resolve({}),
theme.colorScheme.onSurfaceVariant,
);
});
}
@@ -1,6 +1,5 @@
import 'dart:async';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/core/api_gateway.dart';
@@ -64,11 +63,6 @@ Widget _host(Widget child) => MaterialApp(
home: Scaffold(body: child),
);
Widget _cupertinoHost(Widget child) => CupertinoApp(
theme: const CupertinoThemeData(brightness: Brightness.dark),
home: CupertinoPageScaffold(child: child),
);
const _session = <String, dynamic>{
'id': 's',
'backend': 'opencode',
@@ -82,7 +76,6 @@ JsonMap _withSession(Map<String, dynamic> changes) => {..._session, ...changes};
Future<void> _openThread(
WidgetTester tester,
_ModelGateway gateway, {
bool cupertino = false,
JsonMap session = _session,
ValueChanged<ChatModelSelection>? onChanged,
}) async {
@@ -93,7 +86,7 @@ Future<void> _openThread(
onBack: () {},
onModelChanged: onChanged,
);
await tester.pumpWidget(cupertino ? _cupertinoHost(thread) : _host(thread));
await tester.pumpWidget(_host(thread));
await tester.pumpAndSettle();
}
@@ -169,32 +162,28 @@ void main() {
expect(find.text('model-b'), findsNothing);
});
for (final cupertino in [false, true]) {
testWidgets('an accepted switch shows the server-reported model '
'(${cupertino ? 'cupertino' : 'material'})', (tester) async {
final gateway = _ModelGateway()
..modelsReply = _catalog
..switchReply = const {
'chat_model': {
'session_id': 's',
'provider': 'p2',
'model': 'server-reported-model',
'selection': 'next_turn',
},
};
await _openThread(tester, gateway, cupertino: cupertino);
testWidgets('an accepted switch shows the server-reported model ', (
tester,
) async {
final gateway = _ModelGateway()
..modelsReply = _catalog
..switchReply = const {
'chat_model': {
'session_id': 's',
'provider': 'p2',
'model': 'server-reported-model',
'selection': 'next_turn',
},
};
await _openThread(tester, gateway);
await _openChooser(tester);
await tester.tap(find.text('Model Beta'));
await tester.pumpAndSettle();
await _openChooser(tester);
await tester.tap(find.text('Model Beta'));
await tester.pumpAndSettle();
expect(find.text('server-reported-model · next turn'), findsOneWidget);
expect(tester.takeException(), isNull);
if (cupertino) {
expect(find.byType(Material), findsNothing);
}
});
}
expect(find.text('server-reported-model · next turn'), findsOneWidget);
expect(tester.takeException(), isNull);
});
testWidgets('lists only the server catalog and reports an empty one', (
tester,
@@ -306,39 +295,36 @@ void main() {
);
});
for (final cupertino in [false, true]) {
testWidgets('searches the catalog by name, id and provider '
'(${cupertino ? 'cupertino' : 'material'})', (tester) async {
final gateway = _ModelGateway()..modelsReply = _catalog;
await _openThread(tester, gateway, cupertino: cupertino);
await _openChooser(tester);
testWidgets('searches the catalog by name, id and provider ', (tester) async {
final gateway = _ModelGateway()..modelsReply = _catalog;
await _openThread(tester, gateway);
await _openChooser(tester);
final search = find.byKey(const Key('chat-model-search'));
expect(search, findsOneWidget);
final search = find.byKey(const Key('chat-model-search'));
expect(search, findsOneWidget);
await tester.enterText(search, 'beta');
await tester.pumpAndSettle();
expect(find.text('Model Beta'), findsOneWidget);
expect(find.text('Model Alpha'), findsNothing);
await tester.enterText(search, 'beta');
await tester.pumpAndSettle();
expect(find.text('Model Beta'), findsOneWidget);
expect(find.text('Model Alpha'), findsNothing);
await tester.enterText(search, 'P1');
await tester.pumpAndSettle();
expect(find.text('Model Alpha'), findsOneWidget);
expect(find.text('Model Beta'), findsNothing);
await tester.enterText(search, 'P1');
await tester.pumpAndSettle();
expect(find.text('Model Alpha'), findsOneWidget);
expect(find.text('Model Beta'), findsNothing);
await tester.enterText(search, 'zzz');
await tester.pumpAndSettle();
expect(find.text('No models match "zzz".'), findsOneWidget);
expect(find.text('Model Alpha'), findsNothing);
expect(find.text('Model Beta'), findsNothing);
await tester.enterText(search, 'zzz');
await tester.pumpAndSettle();
expect(find.text('No models match "zzz".'), findsOneWidget);
expect(find.text('Model Alpha'), findsNothing);
expect(find.text('Model Beta'), findsNothing);
await tester.enterText(search, '');
await tester.pumpAndSettle();
expect(find.text('Model Alpha'), findsOneWidget);
expect(find.text('Model Beta'), findsOneWidget);
expect(find.text('No models match "zzz".'), findsNothing);
});
}
await tester.enterText(search, '');
await tester.pumpAndSettle();
expect(find.text('Model Alpha'), findsOneWidget);
expect(find.text('Model Beta'), findsOneWidget);
expect(find.text('No models match "zzz".'), findsNothing);
});
testWidgets('marks the current row by id and provider when ids repeat', (
tester,
@@ -405,39 +391,36 @@ void main() {
expect(find.text('model-a'), findsOneWidget);
});
for (final cupertino in [false, true]) {
testWidgets('the chooser fits the smallest surface at 2x text '
'(${cupertino ? 'cupertino' : 'material'})', (tester) async {
tester.view.physicalSize = const Size(320, 640);
tester.view.devicePixelRatio = 1;
tester.platformDispatcher.textScaleFactorTestValue = 2;
addTearDown(tester.view.resetPhysicalSize);
addTearDown(tester.view.resetDevicePixelRatio);
addTearDown(tester.platformDispatcher.clearTextScaleFactorTestValue);
testWidgets('the chooser fits the smallest surface at 2x text ', (
tester,
) async {
tester.view.physicalSize = const Size(320, 640);
tester.view.devicePixelRatio = 1;
tester.platformDispatcher.textScaleFactorTestValue = 2;
addTearDown(tester.view.resetPhysicalSize);
addTearDown(tester.view.resetDevicePixelRatio);
addTearDown(tester.platformDispatcher.clearTextScaleFactorTestValue);
final gateway = _ModelGateway()
..modelsReply = {
'chat_models': [
for (var index = 1; index <= 6; index++)
{
'id': 'model-$index',
'provider': 'provider-$index',
'name': 'Model number $index with a longer name',
},
],
};
await _openThread(tester, gateway, cupertino: cupertino);
await _openChooser(tester);
final gateway = _ModelGateway()
..modelsReply = {
'chat_models': [
for (var index = 1; index <= 6; index++)
{
'id': 'model-$index',
'provider': 'provider-$index',
'name': 'Model number $index with a longer name',
},
],
};
await _openThread(tester, gateway);
await _openChooser(tester);
expect(find.byKey(const Key('chat-model-chooser')), findsOneWidget);
expect(find.byKey(const Key('chat-model-search')), findsOneWidget);
expect(tester.takeException(), isNull);
if (!cupertino) {
// Every row is built inside the dialog's own scroll view.
expect(find.textContaining('Model number 6'), findsOneWidget);
}
});
}
expect(find.byKey(const Key('chat-model-chooser')), findsOneWidget);
expect(find.byKey(const Key('chat-model-search')), findsOneWidget);
expect(tester.takeException(), isNull);
// Every row is built inside the dialog's own scroll view.
expect(find.textContaining('Model number 6'), findsOneWidget);
});
testWidgets('an accepted switch applies after the chooser was dismissed', (
tester,
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/core/api_gateway.dart';
@@ -13,11 +12,6 @@ Widget host(Widget child) => MaterialApp(
home: Scaffold(body: child),
);
Widget cupertinoHost(Widget child) => CupertinoApp(
theme: const CupertinoThemeData(brightness: Brightness.dark),
home: CupertinoPageScaffold(child: child),
);
JsonMap compactionTurn(
String messageId,
String id, [
@@ -376,30 +370,4 @@ void main() {
expect(find.text('Compacting context…'), findsOneWidget);
expect(find.byKey(compactionDismissKey), findsNothing);
});
testWidgets('a running compaction notice is native, dismissed and exact', (
tester,
) async {
final gateway = FakeChatGateway();
addTearDown(gateway.close);
gateway.history = (_) async => chatPage([runningCompaction('c1')]);
await tester.pumpWidget(
cupertinoHost(
ChatThreadView(gateway: gateway, sessionId: 's', onBack: () {}),
),
);
await tester.pumpAndSettle();
expect(find.byKey(const Key('chat-compaction-notice')), findsNothing);
expect(find.text('Compacting context…'), findsOneWidget);
expect(find.byType(Material), findsNothing);
expect(find.bySemanticsLabel('Dismiss compaction notice'), findsOneWidget);
await tester.tap(
find.byKey(const ValueKey<String>('chat-notice-dismiss-compaction')),
);
await tester.pump();
expect(find.text('Compacting context…'), findsNothing);
});
}
@@ -1,6 +1,5 @@
import 'dart:convert';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
@@ -46,20 +45,15 @@ class _ExportGateway extends FakeChatGateway {
}
}
Widget _host(Widget child, bool cupertino) => cupertino
? CupertinoApp(
theme: const CupertinoThemeData(brightness: Brightness.light),
home: CupertinoPageScaffold(child: child),
)
: MaterialApp(
theme: ThemeData(platform: TargetPlatform.android),
home: Scaffold(body: child),
);
Widget _host(Widget child) => MaterialApp(
theme: ThemeData(platform: TargetPlatform.android),
home: Scaffold(body: child),
);
Future<
({_ExportGateway gateway, List<ArtifactFile> shared, List<String> clipboard})
>
_open(WidgetTester tester, {required bool cupertino, JsonMap? row}) async {
_open(WidgetTester tester, {JsonMap? row}) async {
tester.view.physicalSize = const Size(800, 2400);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
@@ -100,7 +94,6 @@ _open(WidgetTester tester, {required bool cupertino, JsonMap? row}) async {
onBack: () {},
fileBridge: bridge,
),
cupertino,
),
);
await tester.pumpAndSettle();
@@ -117,68 +110,58 @@ Future<void> _tap(WidgetTester tester, Key key) async {
void main() {
// Chat details is Material only (a dialog, or a sheet on a phone).
for (final cupertino in [false]) {
final host = cupertino ? 'cupertino' : 'material';
testWidgets('shows the native id, harness and directory', (tester) async {
await _open(tester);
expect(find.text('Session'), findsOneWidget);
expect(find.text('Session ID'), findsOneWidget);
expect(find.text(_id), findsOneWidget);
expect(find.text('Claude'), findsOneWidget);
expect(find.text('/work/app'), findsOneWidget);
expect(find.text(_resume), findsOneWidget);
expect(find.text('Export native session'), findsOneWidget);
expect(find.bySemanticsLabel('Copy session ID'), findsOneWidget);
});
testWidgets('$host: shows the native id, harness and directory', (
tester,
) async {
await _open(tester, cupertino: cupertino);
expect(find.text('Session'), findsOneWidget);
expect(find.text('Session ID'), findsOneWidget);
expect(find.text(_id), findsOneWidget);
expect(find.text('Claude'), findsOneWidget);
expect(find.text('/work/app'), findsOneWidget);
expect(find.text(_resume), findsOneWidget);
expect(find.text('Export native session'), findsOneWidget);
expect(find.bySemanticsLabel('Copy session ID'), findsOneWidget);
testWidgets('copies the id and the resume command', (tester) async {
final opened = await _open(tester);
await _tap(tester, const Key('chat-session-copy-id'));
expect(opened.clipboard, [_id]);
expect(find.text('Copied'), findsOneWidget);
await _tap(tester, const Key('chat-session-copy-resume'));
expect(opened.clipboard, [_id, _resume]);
await tester.pump(const Duration(seconds: 3));
expect(find.text('Copied'), findsNothing);
});
testWidgets('export hands the server file to the file action', (
tester,
) async {
final opened = await _open(tester);
await _tap(tester, const Key('chat-session-export-markdown'));
await tester.pumpAndSettle();
final request = opened.gateway.calls.lastWhere(
(call) => call.type == 'chat_export',
);
expect(request.fields['chat_export'], {
'session_id': _id,
'format': 'markdown',
});
expect(opened.shared, hasLength(1));
final file = opened.shared.single;
expect(file.name, 'Fix-tests.md');
expect(file.mimeType, 'text/markdown');
expect(utf8.decode(file.bytes), '# Fix tests\n');
expect(find.text('Shared Fix-tests.md.'), findsOneWidget);
testWidgets('$host: copies the id and the resume command', (tester) async {
final opened = await _open(tester, cupertino: cupertino);
await _tap(tester, const Key('chat-session-copy-id'));
expect(opened.clipboard, [_id]);
expect(find.text('Copied'), findsOneWidget);
await _tap(tester, const Key('chat-session-copy-resume'));
expect(opened.clipboard, [_id, _resume]);
await tester.pump(const Duration(seconds: 3));
expect(find.text('Copied'), findsNothing);
});
testWidgets('$host: export hands the server file to the file action', (
tester,
) async {
final opened = await _open(tester, cupertino: cupertino);
await _tap(tester, const Key('chat-session-export-markdown'));
await tester.pumpAndSettle();
final request = opened.gateway.calls.lastWhere(
(call) => call.type == 'chat_export',
);
expect(request.fields['chat_export'], {
'session_id': _id,
'format': 'markdown',
});
expect(opened.shared, hasLength(1));
final file = opened.shared.single;
expect(file.name, 'Fix-tests.md');
expect(file.mimeType, 'text/markdown');
expect(utf8.decode(file.bytes), '# Fix tests\n');
expect(find.text('Shared Fix-tests.md.'), findsOneWidget);
await _tap(tester, const Key('chat-session-export-json'));
await tester.pumpAndSettle();
expect(opened.shared.last.name, 'Fix-tests.json');
});
}
await _tap(tester, const Key('chat-session-export-json'));
await tester.pumpAndSettle();
expect(opened.shared.last.name, 'Fix-tests.json');
});
testWidgets('no native export or resume command when the row has none', (
tester,
) async {
await _open(
tester,
cupertino: false,
row: {'id': _id, 'directory': '/work/app'},
);
await _open(tester, row: {'id': _id, 'directory': '/work/app'});
expect(find.text('OpenCode'), findsOneWidget);
expect(find.text('Export native session'), findsNothing);
expect(find.text('Copy resume command'), findsNothing);
@@ -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]) {