import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pluriwave/tema/pluriwave_tokens.dart'; /// Design ADR-1: 3 new colour fields join the existing PluriWaveTokens /// extension (colours belong here because they must participate in lerp). /// Dedicated file under test/tema/ so the WU1 verify command /// (`flutter test test/tema/ ...`) discovers it; the single pre-existing /// PluriWaveTokens assertion inside pluriwave_foundations_test.dart is left /// untouched. void main() { group('PluriWaveTokens — redesign colours', () { test('dark keeps the pre-existing base palette', () { expect(PluriWaveTokens.dark.deepViolet, const Color(0xFF07121A)); // S4 (Tier 1 visual fidelity): the prototype's dominant card radius // is 18 (t4 lines 512, 613, 715, 133) — radiusMd used to be 22, a // systematic +4px drift across every card that defaults to it. expect(PluriWaveTokens.dark.radiusMd, 18); expect(PluriWaveTokens.dark.spacingMd, 16); }); test( 'dark exposes listSurface and liveGreen de-literalised from theme.dart', () { // Design ADR-1: these match the theme's previous raw literals // (surfaceContainerLow / secondary) exactly, so promoting them to // named tokens keeps rendered output byte-identical. expect(PluriWaveTokens.dark.listSurface, const Color(0xFF102532)); expect(PluriWaveTokens.dark.liveGreen, const Color(0xFF7EE4C2)); }, ); test('dark exposes offlineAccent per the proposal (#E8879A)', () { expect(PluriWaveTokens.dark.offlineAccent, const Color(0xFFE8879A)); }); test('copyWith overrides only the new colour fields', () { final overridden = PluriWaveTokens.dark.copyWith( listSurface: Colors.black, liveGreen: Colors.black, offlineAccent: Colors.black, ); expect(overridden.listSurface, Colors.black); expect(overridden.liveGreen, Colors.black); expect(overridden.offlineAccent, Colors.black); // Untouched fields keep their original value. expect(overridden.deepViolet, PluriWaveTokens.dark.deepViolet); }); test('lerp interpolates listSurface, liveGreen and offlineAccent', () { const a = PluriWaveTokens.dark; final b = a.copyWith( listSurface: Colors.white, liveGreen: Colors.white, offlineAccent: Colors.white, ); final mid = a.lerp(b, 0.5); expect(mid.listSurface, Color.lerp(a.listSurface, Colors.white, 0.5)); expect(mid.liveGreen, Color.lerp(a.liveGreen, Colors.white, 0.5)); expect(mid.offlineAccent, Color.lerp(a.offlineAccent, Colors.white, 0.5)); }); }); }