Files
meshcore-open/test/theme/terminal_theme_test.dart
tthandClaude Opus 5.5 55386df69f
build / build (push) Successful in 16m14s
Terminal theme: pure black, square, monospace, IRC-style chat lines
A fourth theme choice "Term" next to System/Light/Dark:
- black surfaces, green accent, JetBrains Mono, no rounded corners,
  compact density and paddings, no ink splash (lib/theme/terminal_theme.dart,
  built on MeshTheme's dark theme with the shapes overridden);
- channel and direct chats render each message as one IRC line across the
  whole width: "14:02 <nick> text [2 hops] ✓", no avatar, no bubble, own
  messages on the left too. Route, region, repeat and delivery status
  follow the text inline; the tracing path stays on its own line.

The upstream bubble code is untouched: both chat screens branch to a
separate builder when MeshStyle.of(context).terminal, so the nightly
upstream merge does not collide with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 11:49:39 +02:00

58 lines
1.8 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:meshcore_open/l10n/app_localizations.dart';
import 'package:meshcore_open/theme/mesh_theme.dart';
import 'package:meshcore_open/theme/terminal_theme.dart';
import 'package:meshcore_open/widgets/terminal_message_line.dart';
Future<void> _pumpLine(WidgetTester tester, {required ThemeData theme}) {
return tester.pumpWidget(
MaterialApp(
theme: theme,
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
home: const Scaffold(
body: TerminalMessageLine(
time: '14:02',
nick: 'tth-x1',
nickColor: Colors.green,
text: 'hello https://example.com',
textColor: Colors.white,
metaColor: Colors.grey,
textScale: 1,
trailing: [
TerminalRouteTag(
isDirect: true,
hops: 2,
color: Colors.grey,
textScale: 1,
),
],
),
),
),
);
}
void main() {
test('only the terminal theme reports the terminal style', () {
expect(MeshTheme.dark().extension<MeshStyle>(), isNull);
expect(terminalTheme().extension<MeshStyle>()?.terminal, isTrue);
expect(terminalTheme().scaffoldBackgroundColor, const Color(0xFF000000));
});
testWidgets('time, nick, text and route share one paragraph', (tester) async {
await _pumpLine(tester, theme: terminalTheme());
// Text.rich on mobile, SelectableText.rich on desktop (the test host).
expect(
find.textContaining(
'14:02 <tth-x1> hello https://example.com',
findRichText: true,
),
findsOneWidget,
);
expect(find.text('[2 hops]'), findsOneWidget);
});
}