// Sealed identity bar — stage-3 contract: nothing on the shared hub, // and while connected to a sealed area a strip in the area colour // naming it + a "Leave" affordance back to the shared hub. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:chain_studio/data/sealed_areas.dart'; import 'package:chain_studio/data/workspace.dart'; import 'package:chain_studio/l10n/app_localizations.dart'; import 'package:chain_studio/widgets/chain_sealed_identity_bar.dart'; Widget _host() => const MaterialApp( localizationsDelegates: AppLocalizations.localizationsDelegates, supportedLocales: AppLocalizations.supportedLocales, home: Scaffold(body: ChainSealedIdentityBar()), ); const _grid = SealedArea( slug: 'grid', name: 'Testbereich Grid', color: '#e0a458', port: 51100, running: true, ); void main() { testWidgets('renders nothing on the shared hub', (tester) async { Workspace.instance.debugSeed(projects: const [], active: ''); await tester.pumpWidget(_host()); expect(find.byIcon(Icons.lock_outline), findsNothing); expect(find.text('Testbereich Grid'), findsNothing); }); testWidgets('names the active sealed area with a lock + leave action', ( tester, ) async { Workspace.instance.debugSeed( projects: const [], active: '', activeSealed: _grid, ); await tester.pumpWidget(_host()); expect(find.text('Testbereich Grid'), findsOneWidget); expect(find.byIcon(Icons.lock_outline), findsOneWidget); // A one-click way back to the shared hub. expect(find.byIcon(Icons.logout), findsOneWidget); // The strip is painted in the area's accent colour (#e0a458), // not the app theme — the "which area am I in?" signal. final material = tester.widget( find.ancestor(of: find.byIcon(Icons.lock_outline), matching: find.byType(Material)).first, ); expect(material.color, const Color(0xFFE0A458)); }); }