Merge main (Notebook) into High contrast; snap theme switches into and out of it

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-04 00:16:46 +00:00
308 changed files with 13499 additions and 5597 deletions
+17
View File
@@ -35,6 +35,23 @@ void main() {
errorAdviceKind(TimeoutException('request timed out after 30000ms')),
ErrorAdviceKind.timeout,
);
expect(
errorAdviceKind(
const ProtocolError('chat is not configured on this server'),
),
ErrorAdviceKind.noHarness,
);
expect(
errorAdviceKind(
'HARNESS TRANSPORT: harness unreachable: cannot run the selected '
'OpenCode CLI',
),
ErrorAdviceKind.noHarness,
);
expect(
errorAdviceSentence(ErrorAdviceKind.noHarness),
contains('pipelines harness setup'),
);
expect(errorAdviceKind('pipeline 4 has no stage review'), isNull);
final advice = errorAdvice(StateError('Connection closed'));
expect(advice?.detail, 'Connection closed');
@@ -106,6 +106,8 @@ void main() {
AppDesign.standard,
AppDesign.terminal,
AppDesign.paper,
AppDesign.notebook,
AppDesign.highContrast,
AppDesign.compact,
]) {
design.value = other;
@@ -5,6 +5,7 @@ import 'package:pipelines_app/features/chat/domain/chat_colors.dart';
import 'package:pipelines_app/features/chat/ui/sessions/chat_color_palette.dart';
import 'package:pipelines_app/ui/adaptive/platform.dart';
import 'package:pipelines_app/ui/theme/app_design.dart';
import 'package:pipelines_app/ui/theme/app_design_controller.dart';
import 'package:pipelines_app/ui/theme/app_design_tokens.dart';
import 'package:pipelines_app/ui/theme/app_theme.dart';
import 'package:pipelines_app/ui/theme/high_contrast_palette.dart';
@@ -54,6 +55,7 @@ void main() {
expect(tokens.largeTargets, isTrue);
expect(tokens.minContrast, highContrastMinimum);
expect(tokens.windowRadius, 6);
expect(tokens.snapSwitch, isTrue);
expect(tokens.ansi, isNotNull);
}
},
@@ -253,6 +255,7 @@ void main() {
expect(tokens.largeTargets, isFalse, reason: design.id);
expect(tokens.minContrast, isNull, reason: design.id);
expect(tokens.windowRadius, isNull, reason: design.id);
expect(tokens.snapSwitch, isFalse, reason: design.id);
expect(tokens.transcript, isNot(TranscriptStyle.boxed));
expect(tokens.selectedRow, isNot(SelectedRowStyle.inverted));
final frame = tokens.frame;
@@ -265,6 +268,18 @@ void main() {
});
});
test('a switch into or out of High contrast snaps; Paper to Terminal '
'still blends', () async {
final designs = AppDesignController(store: MemoryAppDesignStore());
await designs.select(AppDesign.paper);
await designs.select(AppDesign.terminal);
expect(designs.themeAnimationDuration, kThemeAnimationDuration);
await designs.select(AppDesign.highContrast);
expect(designs.themeAnimationDuration, Duration.zero);
await designs.select(AppDesign.paper);
expect(designs.themeAnimationDuration, Duration.zero);
});
testWidgets('touch targets on a desktop only under High contrast', (
tester,
) async {
+128
View File
@@ -0,0 +1,128 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/chat/conversation/chat_draft_store.dart';
import 'package:pipelines_app/features/chat/conversation/chat_thread_view.dart';
import 'package:pipelines_app/features/chat/ui/transcript/notebook/notebook_cell_frame.dart';
import 'package:pipelines_app/ui/theme/app_design.dart';
import 'package:pipelines_app/ui/theme/app_design_tokens.dart';
import '../../features/chat/conversation/chat_composer_bar_fixtures.dart';
ThemeData _theme(Brightness brightness, {String? font}) =>
brightness == Brightness.dark
? AppDesign.notebook.dark(fontFamily: font)
: AppDesign.notebook.light(fontFamily: font);
Widget _thread(ComposerBarGateway gateway, AppDesign design) => MaterialApp(
theme: design.light(),
home: Scaffold(
body: ChatThreadView(
gateway: gateway,
sessionId: 's',
session: const {'id': 's', 'directory': '/Users/ada/repos/tank'},
syncToken: 0,
onBack: () {},
drafts: MemoryChatDraftStore(),
),
),
);
void main() {
test('Notebook is listed with a stable id, a label and one line', () {
expect(AppDesign.fromId('notebook'), AppDesign.notebook);
expect(AppDesign.notebook.label, 'Notebook');
expect(AppDesign.notebook.description, isNot(contains('\n')));
expect(AppDesign.notebook.usesInterfaceFont, isTrue);
});
test('Notebook tokens: cells transcript, cell composer, washed row, '
'4-6px corners, hairlines, flat', () {
for (final brightness in Brightness.values) {
final theme = _theme(brightness);
final tokens = theme.extension<AppDesignTokens>()!;
expect(tokens.design, AppDesign.notebook);
expect(tokens.transcript, TranscriptStyle.cells);
expect(tokens.terminal, isFalse);
expect(tokens.composer, ComposerStyle.cell);
expect(tokens.selectedRow, SelectedRowStyle.washed);
expect(tokens.radius, inInclusiveRange(4, 6));
expect(tokens.flat, isTrue);
expect(tokens.frame, theme.colorScheme.outlineVariant);
expect(tokens.ansi, isNotNull);
// Reading text keeps the interface sans.
expect(tokens.reading.family, isNull);
}
});
test('Notebook pages: white by day, neutral charcoal by night, cells a '
'step off the page', () {
final light = _theme(Brightness.light);
expect(light.scaffoldBackgroundColor, const Color(0xFFFFFFFF));
final dark = _theme(Brightness.dark);
expect(
dark.scaffoldBackgroundColor.computeLuminance(),
inExclusiveRange(0.005, 0.03),
);
for (final theme in [light, dark]) {
final scheme = theme.colorScheme;
expect(scheme.surfaceContainerLow, isNot(scheme.surface));
expect(scheme.onSurface, isNot(scheme.onSurfaceVariant));
}
});
test('Notebook keeps the interface font and caches its themes', () {
expect(
_theme(Brightness.light, font: 'Inter').textTheme.bodyLarge?.fontFamily,
'Inter',
);
expect(identical(_theme(Brightness.dark), _theme(Brightness.dark)), isTrue);
expect(
AppDesign.notebook.build(Brightness.light),
_theme(Brightness.light),
);
});
testWidgets('Notebook: the composer is an In [ ]: input cell whose frame '
'takes the accent on focus', (tester) async {
final gateway = ComposerBarGateway();
addTearDown(gateway.close);
await tester.pumpWidget(_thread(gateway, AppDesign.notebook));
await tester.pumpAndSettle();
expect(find.byKey(const Key('chat-composer-pill')), findsNothing);
expect(find.byKey(const Key('chat-composer-underline')), findsNothing);
final cell = find.byKey(const Key('chat-composer-cell'));
expect(cell, findsOneWidget);
expect(
find.descendant(of: cell, matching: find.text('In [ ]:')),
findsOneWidget,
);
for (final key in [
'chat-composer-attach',
'chat-composer-field',
'chat-composer-primary',
]) {
expect(
find.descendant(of: cell, matching: find.byKey(Key(key))),
findsOneWidget,
);
}
final scheme = Theme.of(tester.element(cell)).colorScheme;
Color frame() {
final paint = tester.widget<CustomPaint>(
find
.descendant(
of: find.byKey(const Key('chat-composer-cell-frame')),
matching: find.byType(CustomPaint),
)
.first,
);
return (paint.painter! as NotebookCellPainter).border;
}
expect(frame(), scheme.outlineVariant);
await tester.tap(find.byKey(const Key('chat-composer-field')));
await tester.pumpAndSettle();
expect(frame(), scheme.primary);
});
}