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 _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(), isNull); expect(terminalTheme().extension()?.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 hello https://example.com', findRichText: true, ), findsOneWidget, ); expect(find.text('[2 hops]'), findsOneWidget); }); }