import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pluriwave/tema/pluriwave_theme.dart'; import 'package:pluriwave/tema/pluriwave_tokens.dart'; import 'package:pluriwave/widgets/pluri_glass_surface.dart'; /// S3+S4 (Tier 1 visual fidelity): the prototype's own system rule (`t4` /// line 40, verbatim) — "Superficie de lista opaca #102532, cristal solo en /// el cromo y en la tarjeta activa" ("Opaque list surface #102532, glass /// only in the chrome and in the active card"). [PluriGlassSurface] is used /// for nearly every card/row in the app, so its OWN default must be the /// opaque fill; only callers that are chrome or the active/now-playing card /// opt into the old blurred look via `glass: true`. void main() { Widget host(Widget child) { return MaterialApp( theme: PluriWaveTheme.dark(), home: Scaffold(body: child), ); } BoxDecoration decorationOf(WidgetTester tester) { final box = tester.widget(find.byType(DecoratedBox).first); return box.decoration as BoxDecoration; } testWidgets('defaults to an OPAQUE listSurface fill with no backdrop blur', ( tester, ) async { await tester.pumpWidget(host(const PluriGlassSurface(child: Text('row')))); final decoration = decorationOf(tester); expect(decoration.color, PluriWaveTokens.dark.listSurface); expect(decoration.color!.a, 1.0, reason: 'must be fully opaque'); expect(find.byType(BackdropFilter), findsNothing); }); testWidgets('defaults its border radius to radiusMd (18 — the ' "prototype's dominant card radius)", (tester) async { await tester.pumpWidget(host(const PluriGlassSurface(child: Text('row')))); final clip = tester.widget(find.byType(ClipRRect).first); expect( clip.borderRadius, BorderRadius.circular(PluriWaveTokens.dark.radiusMd), ); expect(PluriWaveTokens.dark.radiusMd, 18); }); testWidgets('glass:true keeps the old translucent, blurred chrome look', ( tester, ) async { await tester.pumpWidget( host(const PluriGlassSurface(glass: true, child: Text('chrome'))), ); final decoration = decorationOf(tester); expect(decoration.color, PluriWaveTokens.dark.glassSurface); expect(find.byType(BackdropFilter), findsOneWidget); }); }